Run Headless JsTestDriver?

亡梦爱人 提交于 2019-12-07 11:05:30

问题


Is there a way to use jsTestDriver in a headless state where it loads the browsers but does so headlessly (you can't see the browser) or it loads them minimized?


回答1:


There is no way to configure JsTestDriver to open the browser minimized. And you have to open the browsers because they run the JavaScript code.

You can try to create a virtual monitor and open the browser there.

Under linux you can use xvfb for this, for example

xvfb-run java -jar JsTestDriver-1.3.3d.jar --tests all --port 4224 --browser firefox chromium-browser --testOutput jsTests

should open the browser in a virtual window.




回答2:


You could use PhantomJS with JSTestDriver

First start JStestdriver in a command prompt:

java -jar JsTestDriver-1.3.5.jar  --port 9876 --captureConsole --runnerMode DEBUG

Download and use the javascript that is used to capture the Phantom browser from here.

phantomjs.exe phantomjs-jstd.js

Output will be like:

 Wed Oct 31 2012 12:07:26 GMT+0530 (India Standard Time): Attempting (1) to load:

 http://localhost:9876/capture

Run your tests:

java -jar d:\Coding\lib\JsTestDriver-1.3.5.jar --tests all  --runnerMode DEBUG


来源:https://stackoverflow.com/questions/11144537/run-headless-jstestdriver

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