Firoz Rangrez
Firoz Rangrez

Reputation: 41

How to hide the firefox browser in selenium c#

I have been using the selenium to find text from web page.In that function when i run it opens firefox in foreground. I don't want it to be in foreground. Is there any way to hide that browser.

I have developed this in classlibrary project using xUnit.

Thanks.

Upvotes: 2

Views: 166

Answers (1)

Gulshan Yadav
Gulshan Yadav

Reputation: 146

It can be done easily by using this,

options.AddArgument("headless");

and then,

ChromeDriverService service = ChromeDriverService.CreateDefaultService();
service.HideCommandPromptWindow = true;

Upvotes: 1

Related Questions