Does anyone know why this WebDriver function would be failing intermittently in Internet Explorer? Seems to always fail right around the textbox.clear() line. It works perfectly in Firefox, but fails one in every few times in IE. Really frustrating. I'm using the latest Selenium (2.12?), IE 9 on Windows 7 with all Windows updates, Python 2.7.2.


def verify_find_hits(self, terms_hits, search_type):
    """ verify that finding on a phrase gets expected number of hits """
    for term, hits in terms_hits.items():
        textbox = self.browser.find_element_by_id('query')
        findb = self.browser.find_element_by_id('findbutton')
        textbox.clear()  # for when we loop and search more than once
        util.wait_text_displayed(self, 'Privacy Policy')
        if(search_type == 'int'):
            if(hits == 0):
                assert 'no results for your search' in self.browser.page_source
                assert str(hits) + ' total hits' in self.browser.page_source
            if(hits == True):
                assert ' total hits' in self.browser.page_source
                assert 'no results for your search' in self.browser.page_source
  • Got an error message: WebDriverException: Message: 'Message: u\'Element must not be hidden, disabled or read-only\'. So I am going to try putting in a check for enabled/visible just before the .clear()
    – Aaron
    Commented Nov 25, 2011 at 18:20
  • I got the same problem. I use selenium 2.24,python 2.7. Sometimes,the click event failed, while the element needs clicking is present. I mean the case failed in one time,but in most times,it passed. I am sure when it failed,the element is visible or available, because there were no NoSuchElement Exceptions. I am very confused. Commented Jun 21, 2012 at 4:52

1 Answer 1


Sounds like you answered your own question, but to clarify, Webdriver does not allow you to interact with an element that is hidden or disabled. You can check those properties before attempting to interact with an element using the wait function in Webdriver.

  • No, it still fails intermittently even with the detection I put in place. Particularly Internet Explorer. WebDriver's not great about waiting for the complete page to load sometimes.
    – Aaron
    Commented Nov 30, 2011 at 21:16
  • 1
    What are you checking? Both the element's Enabled and Displayed properties? Do you know what your page is doing? Is it actually changing the values based on some javascript that is executing on page load?
    – Sam Woods
    Commented Nov 30, 2011 at 23:11
  • 1
    No, there's no JavaScript at all, and it fails in other places too. It's just WebDriver being flaky with IE.
    – Aaron
    Commented Dec 2, 2011 at 1:01
  • 1
    Ok... but there are only certain ways it can be flaky and I'm trying to help you narrow down what specific thing you are running into. You only see the "Element must not be hidden disabled or read only" if the attributes of the element suggest that it is hidden, disabled or read only. If you are actually checking those values prior to interacting with the element and waiting until they are what you expect then I don't see how you could get that message. Have you tried putting a try/catch and handling that error, waiting for a few seconds and trying again to know for sure if it is timing?
    – Sam Woods
    Commented Dec 2, 2011 at 19:27
  • I'm hitting the same problem. I paused the debugger right before the exception occurs, and inspected the HTML element. It is neither hidden, disabled, or readonly. I believe this is a bug in Selenium that detects a false positive. Commented Jun 13, 2013 at 17:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.