Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 568
geogaddi Avatar asked Aug 08 '12 17:08

geogaddi


People also ask

How do I check if a button is disabled in selenium WebDriver?

How To Verify Element is Enabled or Disabled in Selenium Webdriver? To verify that the target element (Button, Check box, Dropdown, text box, Radio Button, Icons, etc ) are enabled or disabled use isEnabled() Method to check element is enabled or disabled.


1 Answers

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()
like image 180
geogaddi Avatar answered Oct 15 '22 08:10

geogaddi