Reputation: 1999
I am trying find an element with
let selector = "[class='count-stats']";
console.log(browser.element(selector));
Getting an error with
{ type: 'NoSuchElement',
message: 'An element could not be located on the page using the given search p
arameters.',
state: 'failure',
sessionId: 'd16e8f18e203d7d862d36bcb29f86cfa',
value: null,
selector: '[class=count-stats]' }
There is a div
with class name count-stats
on a page.
How do I find an element with class name ?
Upvotes: 0
Views: 1760
Reputation: 460
I've had success with the following formats:
let selector = '[class="count-stats"]';
and
let selector = '.count-stats';
With the first example, I swapped the quotes and single quotes around as the error message you posted didn't look quite right (selector: '[class=count-stats]'
).
If those don't work, are you sure the element you're trying to interact with is visible?
Upvotes: 1
Reputation:
For me your example works. Can you provide a snippet of your html code?
Upvotes: 0