How do I use an existing chrome browser in selenium C# ?

Currently I have the following but it always creates a new window

SessionId sessionId = new SessionId("");
var driver = new phantomJSDriver();
var driver = new PhantomJSDriver();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  • why is driver declared twice? Jul 7 '19 at 11:56
  • WebDriver always creates a new browser, one that is fresh, so you are certain of the state. I would say most people will want to start with a known fresh state before they start executing tests. Jul 7 '19 at 18:24
  • Possible duplicate of sqa.stackexchange.com/questions/34675/… Jul 7 '19 at 18:25
  • Specifying why you want to use an existing window may yield better answers/reframes. [In past projects I've launched the webdriver through Python in an Interactive Mode for a mix of manual and automated testing, but without context I can't be confident if that might be a remotely viable answer for your use-case] Jul 8 '19 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.