A quick fix would be to check if there’s a new chromedriver binary that is available for download and update the chromedriver binary at your local machine.
Between selenium 3 and selenium 4 a lot of things have changed and improvised, but am pretty sure that the basics (which is what your sample code does) remains the same.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
selenium-user...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/f5f1c60a-0d88-4115-b196-c83085cbdf7bn%40googlegroups.com.
WebDriver Driver = new RemoteWebDriver(url, chromeOptions);
//everything works fine here
driver. close();
driver = new RemoteWebDriver(url, chromeOptions); //Failed to start a new session
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a9b7957c-7354-47ee-82ae-83f698d46030n%40googlegroups.com.
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.net.MalformedURLException;
import java.net.URL;
public class SampleTestClass {
private RemoteWebDriver driver;
private static URL url;
static {
try {
url = new URL("http://127.0.0.1:4444/wd/hub");
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@BeforeMethod
public void setup() {
driver = new RemoteWebDriver(url, new ChromeOptions());
}
@Test
public void testMethod() {
driver.get("https://www.google.com");
// driver.close(); This will cause the test to stall.
driver.quit();
driver = new RemoteWebDriver(url, new ChromeOptions());
driver.get("https://www.facebook.com");
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1ce824f9-e74b-4a97-a463-d6a1f3160165n%40googlegroups.com.