Selenium webdriver 通过实习生将焦点切换到Selenium 2中的下一个输入元素
我正在尝试填写下面这样的登录表单,但不起作用Selenium webdriver 通过实习生将焦点切换到Selenium 2中的下一个输入元素,selenium-webdriver,intern,Selenium Webdriver,Intern,我正在尝试填写下面这样的登录表单,但不起作用 this.remote.get('http://localhost:8000/login') .keys('name1') // type on focused username input field .keys('\uE004') // press Tab (this doesn't change the focus??) .keys('pass') // type password .keys('\uE007'); // pre
this.remote.get('http://localhost:8000/login')
.keys('name1') // type on focused username input field
.keys('\uE004') // press Tab (this doesn't change the focus??)
.keys('pass') // type password
.keys('\uE007'); // press Enter to submit
我需要在这里模拟实际用户的操作。您是否尝试使用
键.TAB
常量?比如:
this.remote.get('http://localhost:8000/login')
.keys('name1') // type on focused username input field
.keys(Keys.TAB) // press Tab (this doesn't change the focus??)
.keys('pass') // type password
.keys(Keys.ENTER); // press Enter to submit
您是如何验证发送\ue004没有改变焦点的?您是否尝试过使用
.keys('\t')
?@C Snover,我正在使用intern的runner.js运行测试用例,在新的chrome窗口上运行测试用例时,我可以看到用户名和密码都是在第一个输入元素中输入的。顺便说一句,Enter为我工作(它提交表单)。问题在于chrome27
。它在chrome 29上工作。但它在Mac中的其他浏览器(Firefox(21)
,Safari
)上也不起作用。ReferenceError:没有定义键
@ManoHaran您使用什么语言?Intern不生成全局对象<代码>键不是一件事。