Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 951
Savio Avatar asked Jul 17 '26 07:07

Savio


1 Answers

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')"));
like image 63
undetected Selenium Avatar answered Jul 18 '26 20:07

undetected Selenium



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!