DOH 机器人测试的自动化被弹出消息中断
为了在构建过程中自动化 DOH 测试,我使用 Selenium RC 在与构建机器位于不同域的服务器上启动不同的浏览器(IE 和 Firefox)。每个浏览器都会定向到我们的 runTests.html 以启动 DOH。
有时,当使用 doh.robot 的测试开始时,会显示以下消息:
“DOH 已检测到当前网页正在尝试访问 DOH,但属于与您同意让 DOH 访问的域不同的域如果您不打算通过访问此网页来启动新的 DOH 测试,请立即按“取消”并离开该网页”,
但由于这些测试是无人值守的,因此它只是坐在那里等待有人单击“确定”,然后Selenium 超时(在 IE 8 中,弹出窗口似乎自动消失,但机器人随后不执行任何操作)。
正如我所说,这并不总是发生。在弹出窗口上单击“确定”后,该消息将停止显示,并且该消息可能会消失几个会话,但随后它会再次显示,这似乎是任意的方式。
有谁知道如何防止此弹出窗口显示?
In order to automate DOH tests during our build process, I use Selenium RC to launch different browsers (IE and Firefox) on a server placed on a different domain than the build machine. Each browser is directed to our runTests.html in order to start DOH.
Sometimes, when a test that uses doh.robot starts, the following message is shown:
"DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page"
but since these tests are unattended it just sits there waiting for someone to click OK, and Selenium times out (in IE 8 it seems like the pop-up disappears automatically but the robot does nothing afterward).
As I said, it doesn't always happen. After you click OK on the Pop-up, the message will stop showing, and the message can go away for several sessions, but then it will show again in which seems to be an arbitrary way.
Does anyone knows a way to prevent this pop-up from showing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能不是正确的方法,但在 util/doh/robot/DOHRobot.java 中,您可以修改代码以不检查或始终模拟按“确定”。我自己还没有尝试过,但我可能也需要为我们的一些自动化测试这样做。
This is probably not the correct way to do it, but in util/doh/robot/DOHRobot.java, you may be able to modify the code to not check that or always simulate pressing "OK". I haven't tried it myself, but I may also need to do that for some of our automated testing.
当 DOH 机器人初始化时,它首先尝试单击您要测试的页面的左上角。如果你遮盖了这个div(你可以用firebug看到它),那么消息就会弹出。我认为问题在于您的页面加载速度并不总是足够快。
解决这个问题有点挑战性。我已经有一段时间没有使用 DOH 了,但我认为没有任何方法可以使用 setTimeout 来解决这个问题。 (您可以尝试在 doh.run 命令上使用 setTimeout,但 DOH 机器人可能会在解析任何 doh 命令之前单击该 div。)
您可以做的另一件事是添加一种“wait”命令Selenium 或您用来启动系统的任何 shell 命令。
When the DOH robot is initialized, it first tries to click in the upper left corner of the page you are trying to test. If you obscure this div (you can see it with firebug), then the message will pop up. I think the problem is that your page isn't always loading up quick enough.
It is somewhat of a challenge to fix this. I haven't used DOH in awhile, but I don't think there is any way you can use a setTimeout to fix this. (You can try using setTimeout on the doh.run command, but it might be the case that the DOH robot clicks that div before parsing any doh commands.)
Another thing you might be able to do is add a sort of "wait" command to Selenium, or whatever shell command you are using to fire up the system.