Savio
Savio

Reputation: 75

selenium findElement By.cssSelector for multiple classes

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

Answers (1)

undetected Selenium
undetected Selenium

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

Related Questions