angularjs – 量角器不会自动启动PhantomJS
发布时间:2020-12-17 16:58:10 所属栏目:安全 来源:网络整理
导读:我正在使用量角器(使用grunt-protractor-runner来运行我的E2E Angular测试),但我不能让PhantomJS自动启动. 我的量角器配置如下所示: exports.config = { //seleniumAddress: "http://localhost:9515",specs: [ 'static_src/test/spec/*.js' ],capabilities:
我正在使用量角器(使用grunt-protractor-runner来运行我的E2E Angular测试),但我不能让PhantomJS自动启动.
我的量角器配置如下所示: exports.config = { //seleniumAddress: "http://localhost:9515",specs: [ 'static_src/test/spec/*.js' ],capabilities: { 'browserName': 'phantomjs','phantomjs.binary.path':'./node_modules/phantomjs/bin/phantomjs','phantomjs.cli.args':['--logfile=phantom.log','--loglevel=DEBUG'] } } 我的理解是,使用该配置,量角器将自动启动PhantomJS实例(在phantomjs.binary.path上找到),对其运行测试,使用WebDriver协议直接通信(因此不需要Selenium服务器),然后旋转在PhantomJS实例中. 鉴于, >我上面描述的是预期的行为吗? 解决方法
量角器始终需要Selenium独立服务器.您可以使用webdriver-manager启动它并引用protract.conf.js中的地址,或者您可以指定jar的位置,Protractor将为您启动它.
请参考配置中的jar,例如: seleniumServerJar: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.38.0.jar' 使用此方法,您不必担心启动selenium服务器,但速度稍慢.因此,如果您需要经常重新运行测试,则可以更快地独立于Protractor启动它. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |