量角器测试中的浏览器自动关闭

时间:2016-11-24 14:08:06

标签: javascript jasmine timeout protractor

我一直在进行量角器测试,在测试中关闭。我正在使用带有量角器的茉莉花。 defaultTimeoutInterval设置为defaultTimeoutInterval: 8000000,allScriptsTimeout设置为allScriptsTimeout: 10000000。我的测试需要花费大约一个小时来运行每个it()语句。这是因为他们正在等待某些物体出现。当我增加一些内部时间以使对象看起来更快时,浏览器不会关闭。但这会导致测试失败,因为我需要等待一段时间。所以正在发生的事情是浏览器正在关闭自己的中期测试。我有4个浏览器实例在运行。第一个browserInstance在35分钟后关闭,第二个在5分钟后关闭。我仍然需要这些浏览器来继续运行测试。我的代码中没有browser.close(),我没有做任何事情要求他们关闭。这是我得到的唯一错误:

  

系统信息:os.name:' Mac OS X',os.arch:' x86_64',os.version:' 10.11.5',java .version:' 1.8.0_73'     驱动程序信息:driver.version:未知         at WebDriverError(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10)         at Object.checkLegacyResponse(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)         at parseHttpResponse(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11         在ManagedPromise.invokeCallback_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)         在TaskQueue.execute_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)         在TaskQueue.executeNext_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7         at process._tickCallback(node.js:369:9)     来自:任务:Protractor.waitForAngular() - 定位器:By(css选择器,i.glyphicon-bell)         在WebDriver.schedule(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:377:17)         在ProtractorBrowser.executeAsyncScript_(/usr/local/lib/node_modules/protractor/built/browser.js:236:28)         在runWaitForAngularScript(/usr/local/lib/node_modules/protractor/built/browser.js:264:30)         在ProtractorBrowser.waitForAngular(/usr/local/lib/node_modules/protractor/built/browser.js:270:16)         在ElementArrayFinder.getWebElements(/usr/local/lib/node_modules/protractor/built/element.js:155:29)         在ElementArrayFinder.getWebElements(/usr/local/lib/node_modules/protractor/built/element.js:261:56)         在ElementArrayFinder.ElementFinder.getWebElements(/usr/local/lib/node_modules/protractor/built/element.js:717:39)         在ElementArrayFinder.applyAction_(/usr/local/lib/node_modules/protractor/built/element.js:407:34)         在ElementArrayFinder._this。(匿名函数)[点击](/usr/local/lib/node_modules/protractor/built/element.js:101:30)         在ElementFinder。(匿名函数)[点击](/usr/local/lib/node_modules/protractor/built/element.js:742:22)Error         在ElementArrayFinder.applyAction_(/usr/local/lib/node_modules/protractor/built/element.js:406:27)         在ElementArrayFinder._this。(匿名函数)[点击](/usr/local/lib/node_modules/protractor/built/element.js:101:30)         在ElementFinder。(匿名函数)[点击](/usr/local/lib/node_modules/protractor/built/element.js:742:22)         at /Users/Harman/webapp-qa-tests/js/tests/brackets/4-player-bracket.js:203:64         在ManagedPromise.invokeCallback_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)         在TaskQueue.execute_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)         在TaskQueue.executeNext_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7         at process._tickCallback(node.js:369:9)     来自:任务:在控制流程中运行它("应该允许玩家1承认")         在对象。 (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:79:14)         at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:16:5         在ManagedPromise.invokeCallback_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)         在TaskQueue.execute_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)         在TaskQueue.executeNext_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)         at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27     从异步测试:     错误         在套房。 (/Users/Harman/webapp-qa-tests/js/tests/brackets/4-player-bracket.js:189:9)         在套房。 (/Users/Harman/webapp-qa-tests/js/tests/brackets/4-player-bracket.js:126:5)         在对象。 (/Users/Harman/webapp-qa-tests/js/tests/brackets/4-player-bracket.js:13:1)

我正在运行webdriver 2.24,最新版本的chrome,带有量角器version 4.0.9

我已从错误消息中删除了IP地址和主机名。

1 个答案:

答案 0 :(得分:1)

我认为核心问题是你试图使用旧的selenium版本在最新的浏览器上运行。它应该是2.53.x的东西。

请通过更改package.json文件中的版本将您的量角器版本升级到最新版本4.0.11,并从命令提示符(项目根目录内)执行:

npm update 

然后从命令提示符

使用以下命令更新您的selenium驱动程序
webdriver-manager update

它会将selenium版本更新为最新版本,然后再次尝试运行测试。