Selenium testing without browser popping up

  • 4 Replies
  • 1936 Views
Selenium testing without browser popping up
« on: March 09, 2016, 11:33:21 am »
Is there a way to run selenium automated tests without opening a browser ?
suppose i wanted to run multiple tests at once.
« Last Edit: March 10, 2016, 14:53:22 pm by AndKol »

*

Oren

  • **
  • 59
Re: Selenium testing without browser popping up in python
« Reply #1 on: March 10, 2016, 10:35:46 am »
It is possible, but not with the standard firefox driver / chrome / etc.

You would need to install PhantomJS.
just assign your WebDriver to an instance of phantomJS driver :

driver = webdriver.PhantomJS()

If you run your code now, no browser window will be opened.

Re: Selenium testing without browser popping up in python
« Reply #2 on: March 10, 2016, 14:40:01 pm »
You can also use HTMLUnitDriver, which also does not open a browser window.

Using selenium grid is another option. With selenium grid you could launch a browser on a different machine or VM.

Re: Selenium testing without browser popping up in python
« Reply #3 on: March 10, 2016, 14:51:33 pm »
Thanks guys. PhantomJS is good enough at the moment. perhaps at a later stage i'd need to run on a few more machines

*

Hari Charan

  • *
  • 5
  • The More You Learn The More You Play
    • Automation Guide
Re: Selenium testing without browser popping up
« Reply #4 on: April 17, 2016, 17:39:30 pm »
You can also run your scripts on cloud (Browserstack or Saucelabs) in order to check compatibility. I would suggest to use BrowserStack. Just check with free account.

Using phantomJs or CasperJs is a good thought. But you might face few issues using that. Sometimes elements will load on AJAX where phantomJS will return it failed. It depends on the functionalities too. Just for your information.  :)

Thanks

 

Sitemap 1 2 3 4 5 6 7 8