4

I am selecting this item in Selenium like so:

filter_panel = self.browser.find_element_by_class_name('panel-filters')
filter_onair = filter_panel.find_element_by_css_selector("div.form-group.mod-toggle.js-onair[data-toggle='tooltip'][data-placement='top']")

But How do I test in Selenium if this item has the class disabled?

1 Answer 1

4

You can try

assert 'disabled' in filter_onair.get_attribute('class').split()

or you can try to extend CSS selector with .disabled:

filter_onair = filter_panel.find_element_by_css_selector("div.form-group.mod-toggle.js-onair.disabled[data-toggle='tooltip'][data-placement='top']")

If you get NoSuchElementException then there is no element by required selector that contain "disabled" class name

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.