selenium-webdriver空闲,直到移动鼠标 [英] selenium-webdriver idles until mouse is moved

查看:79
本文介绍了selenium-webdriver空闲,直到移动鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为使用Angular编写的Web应用程序使用Selenium/Protractor/Jasmine编写测试自动化.我正在VirtualBox(主机操作系统:Windows 8,来宾操作系统:Ubuntu 15.04)中运行测试.到目前为止,该测试是非常基础的(onPrepare函数登录并等待应用加载,第一个测试将检查加载的页面是否具有正确的标题.

I am writing test automation using Selenium / Protractor / Jasmine for a web app written with Angular. I am running the test inside VirtualBox (Host OS: Windows 8, Guest OS: Ubuntu 15.04). So far, the test is very basic (the onPrepare function logs in and waits for the app to load, the first test checks to see whether the loaded page has the right title.

该应用程序已成功加载并登录.问题是,一旦发生这种情况,只有在鼠标移到浏览器窗口的内容区域上时,测试才会继续进行.

The app is successfully loading and logging in. The problem is, once this happens, the test does not proceed until the mouse is moved, and only while the mouse is over the content area of the browser window.

1)如果我根本不移动鼠标,最终会收到错误消息:错误:超时-jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时时间内未调用异步回调."

1) If I don't move the mouse at all, I eventually get the error: "Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."

2)如果将鼠标移到其他窗口或浏览器窗口的非内容区域(窗口边框,地址栏等)上,则会得到相同的行为.

2) If I move the mouse over other windows, or over non-content areas of the browser window (window border, address bar, etc), I get the same behavior.

3)一旦我将鼠标移到浏览器窗口的内容区域上,测试就会立即进行.

3) As soon as I move the mouse over the content area of the browser window, the test proceeds immediately.

我已将测试代码提供给在Mac上运行过该代码的同事,但他没有这个问题.在我看来,这是由在VirtualBox中运行引起的问题,但我不是100%肯定是这种情况.

I have given my test code to a coworker who has run it on a Mac, and he did not have this problem. This implies to me that it is an issue caused by running inside VirtualBox, but I am not 100% sure that is the case.

我尝试搜索Google和其他stackoverflow帖子,以查看是否可以找到有关这种行为的其他报告,但没有发现.我还尝试过更改茉莉花和量角器中的默认超时时间:
jasmine.DEFAULT_TIMEOUT_INTERVAL = 250000
allScriptsTimeout:300000
getPageTimeout:300000
,但是没有效果.

I have tried searching through Google and other stackoverflow posts, to see if I could find other reports of this kind of behavior, but found nothing. I also tried changing the default timeouts within jasmine and protractor:
jasmine.DEFAULT_TIMEOUT_INTERVAL = 250000
allScriptsTimeout: 300000
getPageTimeout: 300000
, but this had no effect.

由于这是我对stackoverflow提出的第一个问题,如果通常会提供有关此问题的更多信息,请告诉我,我将添加它.

As this is my first question asked on stackoverflow, if there is more information generally given for this kind of question, please let me know and I will add it.

推荐答案

我遇到了同样的问题,没有找到原因或确定的解决方案.我提出了一个解决方法,在单击操作后移动鼠标.

I had the same problem and did not find a reason or a definitive solution. I made a paleative solution, move the mouse after the click action.

browser.actions().mouseMove({x: 50, y: 0}).perform ();

此后测试正常.

这篇关于selenium-webdriver空闲,直到移动鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆