Find div element by multiple class names?

Not sometimes most of the times you will have an element with multiple last names; in such cases, you can use XPath to locate the element are you can use CSS locator

For example, let's see below one is your element

<div class="first value test"></div>

The XPath for the above HTML should be like this

//div[contains(@class, 'first')]
//div[contains(@class, 'first')][contains(@class, 'value')]
//div[contains(@class, 'first')][contains(@class, 'value')][contains(@class, 'test')]

The CSS locator

div.first
div.first.value
div.first.value.test
In the above locators you can Shuffle the class names
About Author :

I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions