无法使用 watir 网络驱动程序在 iframe 中填写只读文本框
Unable to fill a text box which is read only and in iframe using watir webdriver
我在iframe内有一个只读文本字段要填充。请在下面找到导航。
-
网址为"http://www.broadwaylofts.com/apartments/unitLevel.do?lid=en_US&pid=3015&uid=1866117&msud=Q%20&adAction=initial"
-
点击"每月价格"按钮。
-
您将能够在叠加层上看到一个文本框。
我正在尝试填充该文本框,但无法
以下是我尝试的方法:
-
b.iframe(:class => "lb_iframe_pricegrid").execute_script("window.document.getElementById('actionForm_moveindate').value = '03/20/2015';")
它抛出以下错误
Selenium::WebDriver::Error::JavascriptError: window.document.getElementById(...) is null
b.execute_script("window.document.getElementById('actionForm_moveindate').value = '03/20/2015';")
它抛出以下错误
Selenium::WebDriver::Error::JavascriptError: window.document.getElementById(...) is null
b.iframe(:class => "lb_iframe_pricegrid").text_field.set "02/20/2015"
以下是我面临的错误
Watir::Exception::ObjectReadOnlyException: object is read only {:tag_name=>"input or textarea", :type=>"(any text type)"}
from /Library/Ruby/Gems/2.0.0/gems/watir-webdriver-0.6.10/lib/watir-webdriver/elements/element.rb:553:in `assert_writable'
from /Library/Ruby/Gems/2.0.0/gems/watir-webdriver-0.6.10/lib/watir-webdriver/user_editable.rb:12:in `set'
from (irb):19
from /usr/bin/irb:12:in `<main>'
有什么想法或建议可以使其发挥作用吗?
您的代码应如下所示:
b.execute_script("window.frames[0].document.getElementById('actionForm_moveindate').value = '03/20/2015';")
相关文章:
- 如何使用jquery在填充自动完成的值后使文本框只读
- 在动态crm 2011中,右键单击已完成活动的只读文本时,您是否出现错误
- 如何在单击“提交”按钮后使文本区域和 IMG 标签只读
- 文本框的一部分为只读,具有默认值
- 使用制表键时禁用只读文本框的光标焦点
- 为什么 react 将输入[类型=“文本”] 字段设为只读,除非我提供 onChange 回调
- 如果处理字符串值的文本区域是只读的,如何使用 JavaScript 在虚拟键盘上使用 CAPSLOCK 功能
- 无法使用 watir 网络驱动程序在 iframe 中填写只读文本框
- bootstrap wsyihtml5只读文本区域
- Request.Form集合中缺少只读文本框
- 保存更改后启用只读文本框
- 用于只读文本的HTML标签
- 只读文本框的服务器验证-防止输入值
- 禁用(或)防止光标放置在ASP只读文本框中
- 通过客户端脚本更改时在服务器端访问只读文本框值的解决方案
- 在单选按钮组中,我如何使其中两个启用文本框,其中一个禁用/只读文本框
- 焦点栏上的只读文本输入
- 选中复选框时应清除只读文本框
- 将AngularJS中的输入字段替换为只读文本
- 如何使 jQuery 不以我的只读文本框为目标