2

How can I run chromedriver in background on Windows (Selenium Python)? I want to be able to hide (remain only as a process) or to show the browser (have it in Windows Bar).

I don't want to use PhantomJS or any other headless browser because I want to be able to show the browser if I want. I also don't want to minimize the browser or change the window position.

I could not find any answers to this. Can anyone point me to the right direction? Thanks!

ThousandSteps
  • 67
  • 1
  • 7
  • How is this question too broad? Seem very specific and clear to me. How can you run selenium tests on chrome without having the browser in the foreground, and without using a headless driver? Could those who voted to put this on hold please explain what I'm missing? – Mark Lapierre Apr 19 '17 at 12:20

1 Answers1

1

It's not possible according to the chromedriver team (emphasis mine):

Much like --disable-javascript, the chromedriver will not work if you use --no-startup-window. It needs to launch a window to establish the connection with the AutomationProxy.

That post is about the switches you can use, but the comment seems to apply in general. You can't automate Chrome without a browser window (except for headless Chrome, which you say you don't want).

But you can use other programs while it's running. It doesn't have to run in the foreground. I do that all the time - start a long test that I'm debugging and then switch to another task while I wait for the test to complete.

Another option is to run your tests inside a VM, or inside a docker container running VNC.

Mark Lapierre
  • 1,067
  • 9
  • 15
  • Thanks for your answer. I know I can use other programs while it's running, but I don't want to accidentally access the chrome driver and ruin the test. And onther problem will be if I have, let's say, 30 chrome driver instances opened. I don't want to have them all over my desktop. – ThousandSteps Apr 18 '17 at 20:09
  • Then unfortunately you're out of luck. But I edited my answer with another couple of suggestions. I.e., run the tests inside a VM or a container and use VNC or something similar to watch the tests. A service like Browserstack or Saucelabs is another option, or set up your own Selenium Grid. – Mark Lapierre Apr 18 '17 at 20:23
  • Take a look at this thread, there are different solution for docker and UI are mentioned: https://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container/43082473#43082473 For a principle setup example take a look at [java-selenium-example](https://github.com/ConSol/sakuli-examples/tree/master/java-selenium-example) – toschneck Apr 18 '18 at 09:20