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
26,339 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
4,425 views
0 votes
1 answer

How can we use Selenium with Python?

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

answered May 8, 2018 in Selenium by Meci Matt
• 9,460 points
254 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 6, 2020 in Selenium by Sri
• 3,190 points
12,661 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,150 points
2,853 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,500 points
6,045 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,190 points
6,471 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
4,100 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 3, 2020 in Selenium by Sri
• 3,190 points
5,073 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 21, 2018 in Selenium by king_kenny
• 3,710 points
10,204 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 21, 2018 in Selenium by king_kenny
• 3,710 points
33,723 views