Can we use Selenium to work with an already open browser session

0 votes
Do you'll know if WebDriver can perform testing using a browser instance that's already running instead of a new one?
Apr 24, 2018 in Selenium by kappa3010
• 2,090 points
23,216 views

1 answer to this question.

0 votes

Yup its possible. Instead of a new instance, you can use the existing instance's sessionID to perform the test on the same instacne. Its done by using this:

webdriver.WebDriver.attachToSession(executor, session_id);

More details about the documentation here: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html#WebDriver.attachToSession

answered Apr 24, 2018 by king_kenny
• 3,710 points
this page link is not working its blank
The page link is working fine.
what is this executor

Hello,

Executor
The executor to use when sending commands to the browser.

Hope it helps!!
Thank You!!

Hi! So I wonder where to find the executor and the session_id for the currently opened webpage? It was created by selenium, but somehow I didn't save that piece of info,

Hello,

To find the executor and the session_id for the currently opened webpage follow the below steps:

1.open a driver

driver = webdriver.Firefox()  #python

2.Extract to session_id and _url from driver object.

url = driver.command_executor._url      
session_id = driver.session_id            

Hope it helps!!
Thank You!!

Related Questions In Selenium

0 votes
1 answer

Can Selenium webdriver attach to already open browser window?

Nope, it can't be done. It's one ...READ MORE

answered Sep 25, 2018 in Selenium by Meci Matt
• 9,460 points
3,976 views
0 votes
1 answer

How can we use Selenium with Python?

First  Install Python based on the Operating ...READ MORE

answered May 7, 2018 in Selenium by Meci Matt
• 9,460 points
207 views
0 votes
2 answers

How to open a browser window in full screen using Selenium WebDriver with C#

Hi , we have inbuilt method Maximize(). driver.Manage().Wind ...READ MORE

answered Sep 5, 2020 in Selenium by Sri
• 3,010 points
11,209 views
0 votes
1 answer

How can I use HTML Unit Driver as a headless browser with Selenium?

Hello @Nishant, follow these steps to use ...READ MORE

answered May 17, 2019 in Selenium by Anvi
• 14,110 points
2,407 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
4,594 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,010 points
5,460 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
3,287 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2, 2020 in Selenium by Sri
• 3,010 points
3,873 views
0 votes
1 answer

Need to scroll down for locating an Element with Selenium

There are a couple of options for ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
8,650 views
+4 votes
2 answers

Can we get the HTTP Response Code in Selenium with Java?

It is indeed possible to get http ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
30,540 views