Selenium findElement By.css

I am new to selenium

.

How to search for an element with multiple classes and value.

<div class="md-tile-text--primary md-text">Getting Started</div>

      

using the findElement method By .css

Selector.

+3


source to share


1 answer


To identify a 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 build cssSelector

from text Getting Started

, you can use:

driver.findElement(By.cssSelector("div:contains('Getting Started')"));

      

+1


source







All Articles