Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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.

http://dpaste.com/hold/661035/

def verify_find_hits(self, terms_hits, search_type):
    """ verify that finding on a phrase gets expected number of hits """
    self.browser.implicitly_wait(10)
    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
        textbox.send_keys(term)
        findb.click()
        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
            else:
                assert str(hits) + ' total hits' in self.browser.page_source
        else:
            if(hits == True):
                assert ' total hits' in self.browser.page_source
            else:
                assert 'no results for your search' in self.browser.page_source
share|improve this question
    
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 Nov 25 '11 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. –  Vincent Wong Jun 21 '12 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.

share|improve this answer
    
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 Nov 30 '11 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 Nov 30 '11 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 Dec 2 '11 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 Dec 2 '11 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. –  Judah Himango Jun 13 '13 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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