geogaddi
geogaddi

Reputation: 575

Python/Webdriver Check Select Option is Disabled

I'm using webdriver to test a specific page which sometimes will have options disabled in a form.

I'm trying to select the value directly, and then check whether or not it is enabled.

Here's what I have :

hourly = driver.find_element_by_xpath("//select[@name='frequency']/option[@value='HOURLY']")
self.assertFalse(hourly.isEnabled());

The full path is:

/html/body/div[@class='options']/form/select[@name='frequency']/option[@value='HOURLY']

When I run this snippet, I get the following :

AttributeError: 'WebElemet' object has no attribute 'isEnabled'

Which leads me to think that either:

  1. I'm selecting the wrong thing or..
  2. The thing I'm selecting isn't actually a WebElement as I could only find reference to isEnabled in the API under the remote driver (http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_remote/selenium.webdriver.remote.webelement.html), which wouldn't be the same thing since I'm just using Selenium Webdriver in Python.

Upvotes: 5

Views: 6628

Answers (1)

geogaddi
geogaddi

Reputation: 575

Nevermind, I've been googling so many different docs I forgot entirely just to read the api. The call should be :

is_enabled()

rather than

isEnabled()

Upvotes: 10

Related Questions