简体   繁体   中英

Run Headless JsTestDriver?

有没有办法在无头状态下使用jsTestDriver加载浏览器但是无头(你看不到浏览器)或者加载最小化?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM