Skip to content Skip to sidebar Skip to footer

Webdriverio Select Using Elements Index

I am using WebDriverIO to try to access (ie. getText, getAttribute, click, etc) an element after creating a list of elements. I am easily able to implement this element if I am usi

Solution 1:

I guess you might need to use one of the below two ways:

Way 1:

var elmnts = browser.elements('.someCss');
var element = elmnts.value[0].ELEMENT;
browser.elementIdClick(element);

Way 2:

var element = $$('.someCss')[0];
element.click();

Thanks, Naveen

Solution 2:

Your index reference was placed in the wrong spot. Try:

var myElement = browser.elements('.someCss')[0];
myElement.click();

You don't need to reference the value property, as WebdriverIO is smart enough to infer that for you.

Post a Comment for "Webdriverio Select Using Elements Index"