I am setting up a new Selenium maven project in Eclipse and am using selenium version 4.18.1
In pom.xml file
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.18.1</version>
</dependency>
My java version is 1.11
Whenever I try to run a simple test, I get the error:
*Exception in thread "main" org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: Capabilities {browserName: Chrome, goog:chromeOptions: {args: [], extensions: []}}, error Failed to run command: [--browser, chrome, --language-binding, java, --output, json]
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.22'
Driver info: driver.version: ChromeDriver*
I also get a popup indicating that selenium-manager.exe has been blocked by my organisation due to security implications. When investigating, i found the following ongoing bug associated with selenium-manager.exe: https://github.com/SeleniumHQ/selenium/issues/13130
This indicates that it will continue to be blocked by security until a fix has been made.
I have to use these version of Selenium in order to be compatible with my Chrome version 122.
My question is, is there anyway I can setup bypassing the use of selenium-manager.exe? I also have webdriver manager in my POM file - is it possible to use this instead?
<dependency>
<groupId>oi.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
I have tried to use earlier versions of selenium-java but this is then incompatible with my chrome/java versions. I can't use an earlier java version as my system has automatically upgraded chrome and chrome driver versions to 122. I do not want to downgrade my chrome/chrome driver versions. I have read through all the questions I could find that relate to this but have not found a solution.
I have tried moving the location of the selenium-manager.exe file to see if I could open it elsewhere but I cannot.
Edit: This is the simple test I'm trying to run:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class testRun {
public static void main(String[] args) {
Webdriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.getTitle();
WebElement authenticate = driver.findElement(By.id("login-submit"));
authenticate.click();
System.out.println("test has ended");
driver.quit();
}
}
Refer code below to set up chromedriver.exe
manually in java.
System.setProperty("webdriver.chrome.driver", "C:\\<full path>\\chromedriver.exe");
Webdriver driver = new ChromeDriver();
driver.get("https://www.google.com");