我使用过phantomjs但幻像js的兼容性与量角器有关。虽然在chrome和firefox浏览器中我能找到元素,但在phantomjs中找不到相同的定位器。
答案 0 :(得分:3)
如果您使用的是Linux操作系统,则可以使用xvfb
以无头模式启动Chrome浏览器。
要安装xvfb,请在终端
中运行以下命令sudo apt-get update
sudo apt-get install -y xvfb
安装xfvb后,可以使用以下命令
运行量角器脚本xvfb-run protractor configuration.js
上述命令将以无头模式启动Chrome浏览器,并将执行configuration.js文件中提到的所有规范。
答案 1 :(得分:1)
{
"name": "Protractor-Test",
"version": "1.0.0",
"description": "UI Automation of Media WorkFlow by Protractor",
"main": "conf.js",
"author": "Subhasish Mishra",
"license": "ISC",
"repository": {
"type": "git",
"url": ""
},
"devDependencies": {
"gulp": "^3.9.1",
"jasmine-core": "~2.4.1",
"jasmine-expect": "~2.0.1",
"jasmine-reporters": "~2.1.1",
"karma-junit-reporter": "^0.2.2",
"protractor": "~3.1.1",
"protractor-console": "~2.0.1",
"protractor-html-screenshot-reporter": "0.0.21",
"protractor-jasmine2-html-reporter": "0.0.6",
"selenium-webdriver": "~2.53.2",
"webdriver-manager":"10.2.1"
}
}
我的script.sh
从Jenkins触发量角器测试
新script.sh
个文件
从Jenkins构建后出错
[launcher] Process exited with error code 1
/var/lib/jenkins/workspace/media-msod-automationtest-master/node_modules/protractor/node_modules/q/q.js:155
throw e;
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (/var/lib/jenkins/workspace/media-msod-automationtest-master/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
at Object.goog.loadModule (/var/lib/jenkins/workspace/media-msod-automationtest-master/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
at /var/lib/jenkins/workspace/media-msod-a