硒测试不选择内部框架
我有一个硒测试,我正在尝试启动并运行,但一个问题是它必须选择一个框架并且失败了。
html 看起来像这样
<iframe src="#" name="mainframe" id="mainframe" />
,python 测试使用该命令
sel.select_frame("mainframe")
,当我运行测试时,我得到这样的输出
sel.select_frame("主机") 文件“/usr/lib/python2.4/site-packages/selenium/selenium/selenium.py”,第 901 行,在 select_frame 中 self.do_command("selectFrame", [定位器,]) 文件“/usr/lib/python2.4/site-packages/selenium/selenium/selenium.py”,第 217 行,在 do_command 中 引发异常,数据 异常:错误:找不到元素主机
I have a selenium test that I am trying to get up and running but one problem is that it has to select a frame and is failing at it.
the html looks like this
<iframe src="#" name="mainframe" id="mainframe" />
and the python test uses the command
sel.select_frame("mainframe")
and when I run the test I get an output like this
sel.select_frame("mainframe")
File "/usr/lib/python2.4/site-packages/selenium/selenium/selenium.py", line 901, in select_frame
self.do_command("selectFrame", [locator,])
File "/usr/lib/python2.4/site-packages/selenium/selenium/selenium.py", line 217, in do_command
raise Exception, data
Exception: ERROR: Element mainframe not found
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 iframe 的 CSS 标识符...
Try using the CSS identifier of the iframe...
感谢您的输入,我没有验证上述解决方案是否有效,但问题与脚本在登录应用程序之前执行函数有关
Thanks for the input I did not verify that the above solution works but the problem was related to the script executing a function before it had logged into the application