使用Appium和Protractor测试移动设备时如何启动Chromedriver

时间:2018-12-26 23:41:31

标签: protractor appium appium-android

当我尝试使用Protractor / Appium运行测试脚本时,在我的移动设备上,浏览器会立即打开和关闭。以下是移动设备的配置:

exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4723/wd/hub',
specs: ['./FCPS/esy-Mobile.js'],
jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
},

capabilities: {
    'browserName': 'chrome',
    'appium-version':'1.10.0',
    'platformName': 'android',
    'platformVersion': '8.0',
    'deviceName': 'ce09171920d3e232027e',
    },

以下是运行日志:

> I/update - selenium standalone: file exists C:\FCPS_I\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.141.59.jar
[18:30:11] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
[18:30:11] I/update - chromedriver: file exists C:\FCPS_I\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.45.zip
[18:30:11] I/update - chromedriver: unzipping chromedriver_2.45.zip
[18:30:11] I/update - chromedriver: chromedriver_2.45.exe up to date
[18:30:11] I/update - geckodriver: file exists C:\FCPS_I\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.23.0.zip
[18:30:11] I/update - geckodriver: unzipping geckodriver-v0.23.0.zip
[18:30:11] I/update - geckodriver: geckodriver-v0.23.0.exe up to date
[18:30:12] I/launcher - Running 1 instances of WebDriver
[18:30:12] I/hosted - Using the selenium server at http://localhost:4723/wd/hub
[18:30:30] E/launcher - An unknown server-side error occurred while processing the command. Original error: Failed to start Chromedriver session: A new session could not be created. Details: session not created: please close 'com.micr
osoft.emmx' and try again
  (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 10.0.17134 x86_64)
[18:30:30] E/launcher - WebDriverError: An unknown server-side error occurred while processing the command. Original error: Failed to start Chromedriver session: A new session could not be created. Details: session not created: please
 close 'com.microsoft.emmx' and try again
  (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 10.0.17134 x86_64)
    at Object.checkLegacyResponse (C:\FCPS_I\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (C:\FCPS_I\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\FCPS_I\node_modules\selenium-webdriver\lib\http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\FCPS_I\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\FCPS_I\node_modules\selenium-webdriver\chrome.js:761:15)
    at createDriver (C:\FCPS_I\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\FCPS_I\node_modules\selenium-webdriver\index.js:626:16)
    at Hosted.getNewDriver (C:\FCPS_I\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
    at Runner.createBrowser (C:\FCPS_I\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (C:\FCPS_I\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (C:\FCPS_I\node_modules\q\q.js:834:54)
    at C:\FCPS_I\node_modules\q\q.js:863:30
    at Promise.promise.promiseDispatch (C:\FCPS_I\node_modules\q\q.js:796:13)

如何解决它并运行测试?请帮助。

1 个答案:

答案 0 :(得分:2)

我发现了问题。实际上,Edge浏览器是造成此问题的原因。从手机上卸载Edge后,测试运行正常。