How to run selenium webdriver in the background?

后端 未结 6 1757
误落风尘
误落风尘 2021-01-15 05:36

I\'ve been using Selenium for 2 weeks.

It\'s been really useful so far.

When developing, I like having the browsers pop up so I can see what\'s going on, b

6条回答
  •  萌比男神i
    2021-01-15 05:54

    Phantom is good headless option, but sssuming you want to stick with same tools you are using ... (the following assumes Linux as platform)

    1. install xvfb (apt-get install xvfb)
    2. You can then run selenium/firefox "headless" (assuming Linux) with the following command:-

    DISPLAY=:1 xvfb-run java -jar [selenium JAR filename]

    Now, when your test suite kicks off selenium, it will run using Firefox without browser windows popping up.

提交回复
热议问题