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,080 points
18,391 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,408 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
143 views
0 votes
1 answer

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

Simply Use this: driver.Manage().Window.Maximize(); READ MORE

answered Jun 7, 2018 in Selenium by Samarpit
• 5,890 points
8,681 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,090 points
1,668 views
0 votes
1 answer

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,510 points
3,133 views
0 votes
1 answer
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
2,364 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
2,512 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
6,116 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
25,830 views