Home > Back-end >  Keep selenium out of focus for user
Keep selenium out of focus for user

Time:09-16

I am using selenium in C#. I am curious if there is a way I can make it so that as a user you can still do what it is you are doing without being interrupted by selenium. For example, if I am typing something and selenium opens a new tab, my mouse focuses on the tab it opened and doesn't allow me to type unless I click on where I am typing again. Would this be something to do in code or in windows settings?

CodePudding user response:

Run browser in headless mode , in this case the browser runs without GUI so there won't be any interruption

All browsers support headless flag now , add headless argument to capabilities while creating the browser instance

Previously headless browsers like phantomjs used to use webkit rendering engine but now chrome has inbuild headless support and uses same rendering enginee blink

so there is no effect of quality

CodePudding user response:

You can run in headless mode.

Basically in headless mode as name sounds, there's no windows. You do not even need browser in your system.

Code:

var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--headless");
chromeOptions.addArguments("window-size=1920,1080");
  • Related