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.

We're trying to use Selenium 2.0b3 to verify behavior of a Java web site we've recently acquired from a third party. The site often uses AJAX to plop HTML replacements onto the page.

Internet Explorer, however, findElement of any form input followed by sendKeys only works half the time. For the findElement, we're using a WebDriverWait with an ExpectedCondition returning the element we want, and that returns successfully. Observing the results of the sendKeys on this element, though, we often see nothing appear in the field.

We have no problems filling out login forms that are initially loaded when the HTML page initially loads; these problems seem to entirely occur on anything that's just been loaded with an innerHTML change through an asynchronous request. (We also, perhaps unsurprisingly, don't have these problems with Firefox.)

Adding arbitrary time delays after the page transition but before doing the findElement doesn't appear to help. (I tried waiting for 10 seconds after we saw the async request finish setting innerHTML and the problem still occurred occasionally.)

Any idea what this might be, or how to work around it?

EDIT: Just to be clear, this is happening under IE with Selenium 2 WebDriver.

share|improve this question
    
Is this specific to IE? –  user246 Jun 18 '11 at 0:18
    
Is this Selenium 1 or Selenium using Webdriver? –  sean_robbins Jun 18 '11 at 7:31
    
Sounds similar to a problem I dealt with recently using watir-webdriver (which, if you're using webdriver will be similar). In my case I was able to resolve/ workaround by sending a click at the element (to select it) before using sendKeys. –  sean_robbins Jun 18 '11 at 7:37
    
It's only IE and it's under Selenium 2 WebDriver. Updated text to reflect that. –  Alan Krueger Jun 20 '11 at 13:36
    
@sean_robbins Your suggestion appears to work. If you could promote that to an answer, I'll mark it as the correct one. –  Alan Krueger Jun 20 '11 at 14:25

1 Answer 1

up vote 4 down vote accepted

This sounds similar to a problem I dealt with recently using watir-webdriver (which, if you're using webdriver will be similar). In my case I was able to resolve/ workaround by sending a click at the element (to select it) before using sendKeys. So I suggest you could try sending a click to the element before using sendKeys. :)

share|improve this answer

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.