0

I would like to ask you: Is there any way to run the process which is opening during one of my application methods start?
I 'm writing an app in wpf and this is my firefox driver (selenium) which I want to run in the background:

//create driver using existing profile
IWebDriver driver = new FirefoxDriver(ffprof);
//change a position (browser is invisible on the screen but after 1-2 sec since ff opened so 
//this is not a solution :(. And it exist on taskbar.
driver.Manage().Window.Position = new System.Drawing.Point(-2000,0);
//change webdriver url
driver.Url = url;
//Save this ff proces to variable
Process ffProcess = HelpMethods.GetFirefoxProcess();

And another question when firefox will run as a background process, could I work with it normally (ex. change url or doing something on a website)?

David Medenjak
  • 33,993
  • 14
  • 106
  • 134
kamciono5
  • 73
  • 1
  • 8

1 Answers1

1

You cannot hide firefox application in windows. But you can use PhantomJS web-browser. This is headless browser and you will get exactly what you need.

Example: How to implement PhantomJS with Selenium WebDriver using java

As you using, C# you need to add selenium phantomjs nuGet package to your project. If you will use this code in console/forms application(but not in tests), also you will need to do the following to hide phantomjs console window:

How can I start PhantomJS + Selenium window in background?

Community
  • 1
  • 1
Andrew_STOP_RU_WAR_IN_UA
  • 9,318
  • 5
  • 65
  • 101