Ruby、Watir,以及如何在 Shadow DOM 中填写文本字段? (苹果浏览器)
Ruby, Watir, and how to fill out text fields inside of a Shadow DOM? (Safari)
编辑:找到部分解决方案:我使用的是 Safari。 运行 通过 Chrome 完成的任务将阴影 DOM 中的东西变成了光 Dom 这样我现在就可以访问它了!
我正在尝试自动化浏览器任务并使用 Watir 自动填写一些表单,但我在尝试填写 Shadow DOMs 中的文本框时遇到了最困难的时间。
文本字段的图像:
https://i.imgur.com/FWccWea.png
这是邮政编码文本字段对应的 HTML:
<input class="textbook" id="Fm2_Ctrol19_TextBox" name="Fm2_Ctrol19_TextBox"
onchange="SearchJs.setBackgroundColor(this, SearchJs.checkTextBox_;"
onkeypress="return
SearchJS.onTextBoxKeyPress(event, this);"
onkeyup="SearchJs.setBackgroundColor(this,SearchJs.checkTextBox);"
onpaste="return SearchJs.onTextBoxPaste(event, this);" style="width:100px;
background=color: #ffffff;"
title="The zip code in which the property is located." type="text"> =[=12=]
Shadow Content (User Agent) # The text field is in here, I imagine.
</input>
我对 javascript 和 Shadow DOM 不够熟悉,不知道我用 google 搜索的文章是否相关。
我过去曾尝试使用普通的'Watir,但它在 30 秒超时后出现 Watir::Exception::UnknownObjectException (timed out after 30 seconds, waiting for #<Watir::TextField: located: false; {:id=>"Fm2_Ctrol19_TextBox", :tag_name=>"input"}> to be located)
。
b.text_field(id: 'Fm2_Ctrol19_TextBox').set 'POSTAL CODE HERE' # What I've tried
有没有人有任何信息可以帮助我填写该框?
找到部分解决方案:我使用的是 Safari。 运行 通过 Chrome 完成的任务将阴影 DOM 中的内容变成了光 Dom 这样我现在就可以访问数据了!
编辑:找到部分解决方案:我使用的是 Safari。 运行 通过 Chrome 完成的任务将阴影 DOM 中的东西变成了光 Dom 这样我现在就可以访问它了!
我正在尝试自动化浏览器任务并使用 Watir 自动填写一些表单,但我在尝试填写 Shadow DOMs 中的文本框时遇到了最困难的时间。
文本字段的图像:
https://i.imgur.com/FWccWea.png
这是邮政编码文本字段对应的 HTML:
<input class="textbook" id="Fm2_Ctrol19_TextBox" name="Fm2_Ctrol19_TextBox"
onchange="SearchJs.setBackgroundColor(this, SearchJs.checkTextBox_;"
onkeypress="return
SearchJS.onTextBoxKeyPress(event, this);"
onkeyup="SearchJs.setBackgroundColor(this,SearchJs.checkTextBox);"
onpaste="return SearchJs.onTextBoxPaste(event, this);" style="width:100px;
background=color: #ffffff;"
title="The zip code in which the property is located." type="text"> =[=12=]
Shadow Content (User Agent) # The text field is in here, I imagine.
</input>
我对 javascript 和 Shadow DOM 不够熟悉,不知道我用 google 搜索的文章是否相关。
我过去曾尝试使用普通的'Watir,但它在 30 秒超时后出现 Watir::Exception::UnknownObjectException (timed out after 30 seconds, waiting for #<Watir::TextField: located: false; {:id=>"Fm2_Ctrol19_TextBox", :tag_name=>"input"}> to be located)
。
b.text_field(id: 'Fm2_Ctrol19_TextBox').set 'POSTAL CODE HERE' # What I've tried
有没有人有任何信息可以帮助我填写该框?
找到部分解决方案:我使用的是 Safari。 运行 通过 Chrome 完成的任务将阴影 DOM 中的内容变成了光 Dom 这样我现在就可以访问数据了!