This may be a repetitive question, but I have not found any solution. I recently found a related post Connecting Selenium WebDriver to an existing browser session , but people suggested I ask a new question.
If someone tried to connect selenium web surfing to an existing browser session that was previously generated by selenium itself and was successful in this, please let me know.
I could find a couple of suggestions to try version 2.x for Firefox and selenium 2.X. But these suggestions do not work for selenium 3.X and there are no solutions for the Chrome browser.
I tried all the suggestions for Selenium 25.3, firefox v 46, and it works. But for Chrome with the chrome driver, I can't get it to work.
Edited by:
Here is the code I tried:
Firefox driver launch
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"/StartFirefoxSession_lib/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
The copied source code of RemoteWebDriver and the changed features from private to secure.
protected Capabilities capabilities;
A new RemoteDriverEx class has been created that extends the copied RemoteWebDriver class. The NEW_SESSION command issued by the source driver has been changed to GET_CURRENT_URL
Response response = execute(DriverCommand.GET_CURRENT_URL, Collections.EMPTY_MAP);
Then I tried the JUnit test to check
But I am amazed by the exception
org.openqa.selenium.WebDriverException: No command or response codec has been defined. Unable to proceed
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'WPANDBW7HYD', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_74'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:154)