Keys.TAB 不适用于 Selenium HTMLUnitDriver
我们在项目中使用 HTMLUnitDriver。我们正在使用最新的 Selenium 2.18.0 版本。 我正在尝试使用 Keys.TAB 模拟 TAB 按键 (org.openqa.selenium.Keys) 将光标从用户名字段移动到 密码字段如下:
objWebDriver.findElement(By.id("username")).sendKeys(Keys.TAB);
//Verify that focus is set to password text box.
assertEquals(objWebDriver.findElement(By.id("password")),
objWebDriver.switchTo().activeElement()); //Test fails here saying the
focus is still on Username field
但是,相同的代码在 FirefoxDriver 上运行良好。
如果有人对此有任何想法或使用模拟 TAB 键按下 HTMLUnitDriver,请告诉我。
We are using HTMLUnitDriver in our project. We are using the latest
version of Selenium 2.18.0.
I'm trying to simulate TAB key press using Keys.TAB
(org.openqa.selenium.Keys) to move the cursor from Username field to
password field as follows:
objWebDriver.findElement(By.id("username")).sendKeys(Keys.TAB);
//Verify that focus is set to password text box.
assertEquals(objWebDriver.findElement(By.id("password")),
objWebDriver.switchTo().activeElement()); //Test fails here saying the
focus is still on Username field
But, the same code works fine on FirefoxDriver.
If anybody has any idea on this or on simulating TAB key press using
HTMLUnitDriver, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论