Remote Watir-Webdriver IE form field not recognizing text and keys

橙三吉。 提交于 2019-12-24 03:25:38

问题


I have been using Cucumber / Watir-Webdriver just fine with IE. In my tests, I go to a form field and enter data and click a save button. All actions work great.

Recently I decided to go with Selenium Grid 2 to distribute tests across machines for performance reasons. It worked great with FF and Chrome but I began to see a problem with IE.

Here's the problem:

when I use Selenium Grid 2 to drive IE remotely, when it sends keystrokes (i.e. send_keys or .set "some string of text") the text is correctly displayed in the field, BUT the field validation doesn't recognize the text.

On saving the form, I will get an error saying "please enter a Description" - yet the description is there.

This works fine if I run the test locally with watir-webdriver (and IE), but only has this issue when the test is being driven from Selenium Grid.

Here's how I've set up my browser with the Grid:

@browser = Watir::Browser.new(:remote, :url=>"http://[myhost]:4444/wd/hub", :desired_capabilities=> browser_name)
where browser_name is currently set to ie.

On the remote machine I set up the node with:

java -jar selenium-server-standalone-[version].jar -role node -hub [path to the above hub, ie http://[myhost]:4444/grid/register] -browser browserName="internet explorer"

The test code itself is pretty simple, it logs in to our internal application, then it clicks a button that presents a form. In the form it sends data to a field and clicks save.

The test does this:

Watir::Wait.until { @browser.div(:id=>"after-announcement-container").text_field(:name=>'Description').exists?}
@browser.div(:id=>"after-announcement-container").text_field(:name=>'Description').set "This is a Test"
@browser.div(:id=>'save-announcement-button').click

When I run the test the Grid:

  1. sends the test to the machine

  2. IE on the remote machine starts

  3. IE automates through the application

  4. At the form, it sends the text correctly ("This is a test")

  5. IE clicks save.

At this point the form says "Please provide a description" (which is there and reads "This is a test.")

I've Tried:

  1. adding wait time

  2. using send_keys like :tab and :click to enter the field first before sending text.

  3. I have also kept the webdriver session open and manually saving (clicking save) and I always get the error. even clicking around the app and clicking save - it still thinks the field is empty. Once I manually type one keystroke though, it works.

Webdriver Output:

Webdriver does have some output, showing it's sending the text fine, and I can visually see it in the form:

11:06:21.296 INFO - Executing: [send keys: 7 org.openqa.selenium.support.events.
EventFiringWebDriver$EventFiringWebElement@f3140943, [This is a Test]] at URL: /
session/135941c9-389d-45fa-9fed-14620a4802ca/element/7/value)
11:06:21.662 INFO - Done: /session/135941c9-389d-45fa-9fed-14620a4802ca/element/
7/value
11:06:23.192 INFO - Executing: org.openqa.selenium.remote.server.handler.Status@
4ead24d9 at URL: /status) 

The weird part to me, is that this works if I am using watir-webdriver locally. I only have this problem when the Grid is sending the webdriver test.

Since this works manually, the developer doesn't see this as a bug. So I can't get much assistance to get this resolved by changing the JS. I'm hoping there's a solution to get this to work with the Grid.

来源:https://stackoverflow.com/questions/15394427/remote-watir-webdriver-ie-form-field-not-recognizing-text-and-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!