Every time I restart my Java application. Then create a new instance of the ChromeDriver() class. This in turn starts a new Chrome browser.
I want to be able to carry on where I left off. So while I'm building code for a given step or webpage. One of many in my automation sequence. I can edit code and relaunch. Without having to start the whole thing or sequence again.
This is my basic Java implementation to start a chrome browser which is ready for automation.
package jack;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
public class JacksClass {
WebDriver driver;
public void launchBrowser() {
// Set file path of chrome driver
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
// Create object
driver = new ChromeDriver();
// Open our browser to this URL
driver.get("https://google.com");
}
public static void main(String[] args) {
JacksClass obj = new JacksClass();
obj.launchBrowser();
}
}
Is this possible by saving a session ID? Then reusing that session ID next time on startup? So I can just reconnect to the current browser open?
Can an amazing individual edit my code to do what I need? Thank you, I appreciate the community.