1

Is it possible to pass control of a USER OPENED browser to a selenium webdriver? For example, lets say, I'm browsing a site (manually) and like a particular page www.facebook.com and I decide to scrape it. How can I pass control of THIS PAGE to my chrome web driver and have selenium do whatever scraping I need? I dont mind switching browsers and I use a Mac.

I was able to figure out how to initiate a browser session from the webdriver and then pick it up with another web driver later on using the session id and executor url, however, I need the user to be able to initiate the session. How can this be achieved?

Thanks

PS: I know I can use the .get(url) or .gotourl(url) methods and make selenium go to any site I want, but instead I'd like the browser to be already opened in whatever user browsing session, and upon user discretion, have selenium scrape that particular site on request. He needs to have minimal to no code intervention. How might we achieve this?

Deepak
  • 149
  • 1
  • 1
  • 11
  • 1
    Why do you wanna initiate a browser, if you are already browsing site manually? – cruisepandey Apr 23 '18 at 06:57
  • selenium initiating a session is reduntant, it just have to pick up where the user browses to and points it to open and crawl that particular page. – Deepak Apr 23 '18 at 07:17
  • It doesn't convincing that you should go for automation in that case. – cruisepandey Apr 23 '18 at 07:22
  • That is my use - case. If you know how to achieve this, please say how. Thank you. – Deepak Apr 23 '18 at 07:39
  • Possible duplicate of [How can I reconnect to the browser opened by webdriver with selenium?](https://stackoverflow.com/questions/47861813/how-can-i-reconnect-to-the-browser-opened-by-webdriver-with-selenium) – undetected Selenium Apr 23 '18 at 10:38

1 Answers1

0

You cannot do that. Instead, try the below solution. Once you have created webdriver instance, you can navigate to any page by invoking webDriverInstance.navigate().GoToUrl("provideURL_here")

Magesh
  • 308
  • 1
  • 4
  • 18