Jaydeep
Jaydeep

Reputation: 803

How to find the exact class by CSS Selector in selenium python?

I want to get all class named = "panel-content" only, so i have done this:

driver.find_elements_by_css_selector("div.panel-content")

but it also selects the class named = "accordion-table panel-content", as it has "panel-content" string in it's name. but what i want is only "panel-content" class.how to do that?

Upvotes: 3

Views: 4565

Answers (1)

Infern0
Infern0

Reputation: 2814

https://www.w3schools.com/cssref/css_selectors.asp

Here you go:

CSS selector:

[class='panel-content']

Locator:

driver.find_elements_by_css_selector("[class='panel-content']")

Upvotes: 2

Related Questions