Protractor test on phantomjs with the use of selenium standalone jar,

為{幸葍}努か 提交于 2019-12-24 02:18:46

问题


I am trying to run protractor tests on phantomjs with the use of selenium-standalone-server.jar but it is giving me such error.I am running this in ubuntu 14.04.

Here is my protractor-config.js file

exports.config = {

    framework: 'cucumber',

    seleniumServerJar: 'node_modules/selenium-standalone/.selenium/2.43.1/server.jar',

    specs: [
        'specs/cucumber/*.feature'
    ],
    baseUrl: '',
    cucumberOpts: {
        format: 'pretty'
    },
    capabilities: {
        browserName: 'phantomjs',
        'phantomjs.binary.path': 'node_modules/phantomjs/bin/phantomjs',
        shardTestFiles: true,
        maxInstances: 3
    }
};

ERROR:

    Running "protractor:phantom" (protractor) task
Starting selenium standalone server...
Selenium standalone server started at http://172.31.9.51:38462/wd/hub

 PROJECT_DIR/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:148
   var session = flow.execute(function() {
                      ^
 UnknownError: The driver is not executable: PROJECT_DIR/node_modules/phantomjs/bin/phantomjs
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
     at <anonymous>
 ==== async task ====
 WebDriver.createSession()
     at Function.webdriver.WebDriver.acquireSession_ (PROJECT_DIR/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:148:22)
     at Function.webdriver.WebDriver.createSession (PROJECT_DIR/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:122:30)
     at Builder.build (PROJECT_DIR/node_modules/protractor/node_modules/selenium-webdriver/builder.js:293:22)
     at LocalDriverProvider.getDriver (PROJECT_DIR/node_modules/protractor/lib/driverProviders/local.js:121:9)
     at PROJECT_DIR/node_modules/protractor/lib/runner.js:238:41
     at _fulfilled (PROJECT_DIR/node_modules/protractor/node_modules/q/q.js:797:54)
     at self.promiseDispatch.done (PROJECT_DIR/node_modules/protractor/node_modules/q/q.js:826:30)
     at Promise.promise.promiseDispatch (PROJECT_DIR/node_modules/protractor/node_modules/q/q.js:759:13)
     at PROJECT_DIR/node_modules/protractor/node_modules/q/q.js:573:44
 >> 
 Fatal error: protractor exited with code: 1

Please help me to solve this.


回答1:


Its to late but this is my protractor.config.js

exports.config = {
 baseUrl: 'http://localhost:9001',
 seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
 framework: 'cucumber',
 specs: [
  'test/features/*.feature'
 ],
 capabilities: {
   browserName: 'phantomjs',
   'phantomjs.binary.path': './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/bin/phantomjs',
   'phantomjs.cli.args': '--web-security=false --debug=true --webdriver --webdriver-logfile=webdriver.log --webdriver-loglevel=DEBUG',
   version: '',
   platform: 'ANY'
 },
 cucumberOpts: {
  require: 'test/features/steps/*_step.js',
  format: 'pretty'
 }
}


来源:https://stackoverflow.com/questions/26096786/protractor-test-on-phantomjs-with-the-use-of-selenium-standalone-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!