Webdriver IO中的帧处理 [英] Frame handling in Webdriver IO
问题描述
我正在测试具有多种形式的网页.
I am testing a webpage that has multiple forms in it.
当我使用
client.frame({id:client.element('#frameId')});
我没有收到任何错误,但是当我尝试与该框架中的元素进行交互时,我收到一个 RuntimeError ,告诉我找不到该元素.
I don't get any error, but when I try to interact with an element within that frame I get a RuntimeError telling me the element could not be located.
我一直在寻找有关frame()
方法如何工作的文献,但是我没有任何运气.
I have been looking out for literature about how the frame()
method works but I don't have any luck.
推荐答案
我也在使用webdriver.io,看来文档有点不对.
I was also using webdriver.io and it looks like documentation is a bit wrong.
您可以访问框架:
1)通过页面上的号码.例如,HTML DOM中遇到的第一帧是
client.frame(0)
,第二个client.frame(1)
等
1) via it's number on the page. For example the first frame met in HTML DOM is
client.frame(0)
, second client.frame(1)
etc
2)通过名称属性:
<frame name="test"></frame>
client.frame('test')
2) via name attribute:
<frame name="test"></frame>
client.frame('test')
3)找到具有client.element('css_selector')
的元素,然后在回调中将返回的值传递给.frame()
3) find the element with client.element('css_selector')
, then in a callback pass the returned value to the .frame()
这篇关于Webdriver IO中的帧处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!