SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
346 stars 194 forks source link

selenium webdriver is clearing out fields after sendKeys had previously populated them #3461

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 3461

The webpage that I'm testing is using knockout.  On other pages on our site that are
not currently using knockout I'm not having the same problem.  The scenario I have
is where the page opens, I enter in various required fields and click the save button.
 At some point between when it enters a value in the last text field and when it clicks
the save button the fields that previously had values become cleared out, and thus
the script can't continue.  Here is an example of the code that I'm running:

driver.findElement(By.id("sku")).clear();
driver.findElement(By.id("sku")).sendKeys(itemNo);
driver.findElement(By.id("desktopThankYouPage")).clear();
driver.findElement(By.id("desktopThankYouPage")).sendKeys(downloadUrl);
driver.findElement(By.id("mobileThankYouPage")).clear();            driver.findElement(By.id("mobileThankYouPage")).sendKeys(mobileDownloadUrl);
driver.findElement(By.id("initialPrice")).clear();
driver.findElement(By.id("initialPrice")).sendKeys(initialPrice);
driver.findElement(By.id("submitSiteChanges")).click();

Like I said, between the time it enters text in the last field and the time it clicks
save the fields that previously had text in them get cleared out, and thus my test
fails.  The problem is it doesn't always happen.  Sometimes the test runs fine, other
times it doesn't.

I've tried putting Thread.sleep(x); all over the place to see if pausing at certain
points would fix the problem.  I also have tried using javascript to wait in the background
for any ajax that might be running.  Also have the implicit wait of driver.manage().timeouts().implicitlyWait(10,
TimeUnit.SECONDS).  None of it seemingly has made any difference.

I'm running version 2.13 of selenium server and all my tests run on Firefox 8.

Any help on this would be greatly appreciated!

Reported by gziebold on 2012-02-29 04:24:14

lukeis commented 8 years ago
Please check if the isue still persists in the latest selenium version (that is 2.21
at the moment). Don't forget that selenium should use native events to deal with frameworks
like knockout.

Reported by barancev on 2012-05-11 15:11:42

lukeis commented 8 years ago
upgrading our version of firefox from 3 to 11 seemingly resolved most of our issues,
but I will rev to the latest version of selenium as well to see if that fixes the remainder.
 Thanks.

Reported by gziebold on 2012-05-18 14:55:45

lukeis commented 8 years ago
Is this still actual?

Reported by barancev on 2012-07-17 09:51:58

lukeis commented 8 years ago
yeah, still seeing this issue.  I'm selenium 2.24.1 now, and I've tried my tests on
different browsers (firefox, chrome) and different operating systems (ubuntu, mac,
and windows) and get the same results where fields are mysteriously clearing out. 

Reported by gziebold on 2012-07-17 15:21:56

lukeis commented 8 years ago
Would you please provide a reproducible sample?
I can't reproduce the issue.
This scenario against the live knockout demo is working as expected:

driver = new FirefoxDriver()
driver.get("http://knockoutjs.com/examples/helloWorld.html")
example = driver.findElement(By.cssSelector("div.liveExample"))
inputs = example.findElements(By.tagName("input"))
inputs[0].clear()
inputs[0].sendKeys("Alexei")
inputs[1].clear()
inputs[1].sendKeys("Barantsev")
example.findElement(By.tagName("h2")).click()

Reported by barancev on 2012-12-26 20:53:57

lukeis commented 8 years ago

Reported by barancev on 2013-02-24 21:27:44

lukeis commented 8 years ago
I am facing same problem tried almost all the solutions given in google

Reported by pravallika.esarla on 2015-01-28 04:27:49

lukeis commented 8 years ago
I am facing the same issue and nothing seems to solve it. Out of desperation i used
Thread.sleep() but that does not solve it as well. It works sometimes and does not
works the other times

Reported by aniruddhach125 on 2015-02-02 20:37:27

lukeis commented 8 years ago
Same. This problem is NOT fixed.

Reported by wmcmorrow on 2015-06-01 18:14:27

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:14:54