我正在使用webdriverio v4来测试我的应用程序,但是在使用PhantomJS运行测试时遇到了问题。我不认为这个问题来自webdriverio,它更多的是PhantomJS或Selenium问题,我需要你的帮助来试图理解错误。
使用waitForExist
方法运行测试时,PhantomJS总是会死掉。
我的测试看起来像这样:
browser.setViewportSize({ width: 1024, height: 768 }, false);
browser.click('input[name="login"]');
browser.waitForExist('#app [data-test="header"]');
我收到以下错误:
/Users/Alex/Workspace/automation/selenium/node_modules/wdio-jasmine-framework/node_modules/wdio-sync/node_modules/fibers/future.js:313
throw(ex);
CommandError: Promise was rejected with the following reason: Error: Error communicating with the remote browser. It may have died.
at Object.Future.wait (/Users/Alex/Workspace/automation/selenium/node_modules/wdio-jasmine-framework/node_modules/wdio-sync/node_modules/fibers/future.js:449:15)
at Object.waitForExist (/Users/Alex/Workspace/automation/selenium/node_modules/wdio-jasmine-framework/node_modules/wdio-sync/build/index.js:345:27)
at Object.module.exports.login (/Users/Alex/Workspace/automation/selenium/tests/common/session.js:11:11)
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'Administrators-MacBook-Pro.local', ip: '172.28.12.169', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_73'
Driver info: driver.version: EventFiringWebDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, handlesAlerts=false, databaseEnabled=false, version=2.1.1, platform=OS X 10.10, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, acceptSslCerts=false, driverVersion=1.2.0, locationContextEnabled=false, webStorageEnabled=false, browserName=phantomjs, takesScreenshot=true, driverName=ghostdriver, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 30d84640-fcd2-11e5-a777-79bf0069d2a8
at elements("#app [data-test="header"]") - isExisting.js:45:17
at isExisting("#app [data-test="header"]") - waitForExist.js:40:22
我似乎没有等待任何事情,总是崩溃。它适用于Chrome和Firefox。
知道为什么吗?
感谢。