So if I do the following:
driver = webdriver.Chrome() # this results in the browser displaying the about page
driver.get("http://somesite.com/") # now the browser goes to the URL
Then if I check the history length via the javascript console in the browser I get a value of 2. I need to simulate the situation where a new tab or window is opened with the URL and thus a history length of 1.
Thanks in advance.
You can set some specific flags to pass to your WebDriver when you initialize it. You can see examples here (for Chrome), and there is also a link to a full list of switches. Here is how to set the homepage for ChromeDriver in java:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches",
Arrays.asList("--homepage=http://somesite.com/"));
WebDriver driver = new ChromeDriver(capabilities);
options.AddArgument("--homepage \"url\""); like this, set null homepage: options.AddArgument("--homepage \"data:,\"");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With