如何使用无头浏览器在Jenkins中运行量角器测试用例? [英] How to run protractor testcases in Jenkins with a headless browser?

查看:118
本文介绍了如何使用无头浏览器在Jenkins中运行量角器测试用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了phantomjs,但是phantom js与量角器的兼容性不好.尽管在chrome和firefox浏览器中我可以找到元素,但是在phantomjs中找不到相同的定位符.

I have used phantomjs but compatibility of phantom js is bad with protractor. Though in chrome and firefox browser I am able to find elements but same locators are not found in phantomjs.

推荐答案

如果您使用的是Linux OS,则可以使用xvfb以无头模式启动chrome浏览器.

If you are using linux OS then you can use xvfb to launch the chrome browser in headless mode.

要安装xvfb,请在终端中运行以下命令

To install xvfb, run the below commands in terminal

sudo apt-get update

sudo apt-get install -y xvfb

一旦安装了xfvb,就可以使用以下命令运行量角器脚本,

Once you install xfvb, you can run your protractor scripts using the below command,

xvfb-run protractor configuration.js

以上命令将以无头模式启动chrome浏览器,并将执行configuration.js文件中提到的所有规范.

The above command will start your chrome browser in headless mode and will execute all specs mentioned in the configuration.js file.

这篇关于如何使用无头浏览器在Jenkins中运行量角器测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆