如何创建一个在使用 firewatir 输入启用之前处于禁用状态的文本字段?
尝试设置职位名称时,“添加职位名称”按钮会隐藏,直到输入文本。使用以下代码添加职位时,禁用的按钮不会变为启用。
browser.text_field(:name, "addJobTitleValue").set firstJobTitle
有没有办法设置 text_field 并启用按钮?
When attempting to setup a Job Title the "add job title" buttons are hidden until text is entered. Using the following code to add a job title the disabled button does not become enabled.
browser.text_field(:name, "addJobTitleValue").set firstJobTitle
Is there a way to set the text_field and have the button become enabled?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过使用 watir-webdriver 与 firewatir,我能够使用这些代码行来启用按钮:
这解决了我的问题,并说服我正式开始切换到 watir-webdriver。
By using the watir-webdriver versus firewatir I was able to use these lines of code to enable the button:
This has solved the problem to me and convinced me officially to start the switch to watir-webdriver.
我希望使用 firewatir 的 .fire_events 之一会产生与所选答案相同的效果,并且避免切换到 watir-webdriver 的需要。
例如,
用其他 JavaScript 事件替换 onclick,直到触发按钮启用。
如果没有实际的页面进行实验,我猜测
.fire_event("onchange")
或.fire_event("onkeydown")
或.fire_event(" onkeyup")
能够启用您想要按下的按钮。I would expect that using one of firewatir's .fire_events would have had the same effect as the chosen answer, and avoided the need to swap over to watir-webdriver.
E.g.
replacing onclick with the other javascript events, until one triggers the button to be enabled.
Without an actual page to experiment with, I'd guess at
.fire_event("onchange")
or.fire_event("onkeydown")
or.fire_event("onkeyup")
being able to enable the button you wanted to press.