Reputation: 75
I am new to selenium
.
How do search for an element with multiple classes and value.
<div class="md-tile-text--primary md-text">Getting Started</div>
using findElement By .css
Selector.
Upvotes: 3
Views: 2822
Reputation: 193388
To identify the node:
div class="md-tile-text--primary md-text">Getting Started
You can use the following cssSelector
:
driver.findElement(By.cssSelector("div.md-tile-text--primary.md-text"));
To construct a cssSelector
based on the text Getting Started
you can use:
driver.findElement(By.cssSelector("div:contains('Getting Started')"));
Upvotes: 3