mardi 26 juillet 2016

No result with SendKeys to IE8 using Selenium on BrowserStack

I'm using Selenium to perform testing on BrowserStack, and have hit a problem while testing IE8.

I've found that when I target elements and then call Click, the full effect of the action is not being undertaken*.

Through trial-and-error I found that if I call Click twice then the expected action is undertaken.

However, one of the testing steps involves writing a number to a text field, and for this I have the following:

driver.FindElement(By.CssSelector("...")).Click();
driver.FindElement(By.CssSelector("...")).Clear();
driver.FindElement(By.CssSelector("...")).SendKeys(Keys.NumberPad1);
driver.FindElement(By.CssSelector("...")).Click();

But "1" never appears in the field. I can tell it never appears because I'm capturing screenshots after each step; I can see that the field gets highlighted (as the active element) and I can see the cursor inside the field, but no result from the method call.

Does anyone have any suggestions as to how I may send a textual value to a field in IE8 using Selenium and BrowserStack?

* The "expected action" involves using Knockout.js to display a selected value in another element. So for example, I found that if I programmatically click a radio button and then take a screenshot, I can see that the radio button has been clicked but the action performed by Knockout.js has not taken place; if I click the element a second time then the Knockout.js action is performed. This double-clicking is not required when I manually test using IE8 via BrowserStack.

Aucun commentaire:

Enregistrer un commentaire