How to find an element by CSS class with XPath?

Spread the love

Sometimes, we want to find an element by CSS class with XPath.

In this article, we’ll look at how to find an element by CSS class with XPath.

How to find an element by CSS class with XPath?

To find an element by CSS class with XPath, we can use @class.

For instance, we write

//div[@class="Test"]

to select all the divs with class Test.

Conclusion

To find an element by CSS class with XPath, we can use @class.

Leave a Reply

Your email address will not be published.