I am seeing this error:
Starting ChromeDriver 97.0.4692.71 (adefa7837d02a07a604c1e6eff0b3a09422ab88d-refs/branch-heads/4692@{#1247}) on port 17892
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, chromeOptions=org.openqa.selenium.chrome.ChromeOptions@1b550c0, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'censored', ip: 'censored', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_311'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:178)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:167)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
at com.testing.test.automation.controller.AutomationController.process(AutomationController.java:91)
at com.onsemi.fast.automation.controller.AutomationController$1.run(AutomationController.java:64)
at java.lang.Thread.run(Thread.java:748)
Code in Main:
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
//File bin = new File("phantomjs.exe");
//System.setProperty("phantomjs.binary.path", bin.getAbsolutePath());
//WebDriver driver = new PhantomJSDriver();
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get(data.getUrl());
It is working fine when I am using PhantomJSDriver but when I am using Chrome or even firefox it is getting the error from above. It is just opening a blank chrome window but is not directing to my given url.
For reference this is my pom.xml, I am currently figuring out if this is just because of the versions but kindly please help:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.testing.test</groupId>
<artifactId>automation</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>automation</name>
<description>Selenium Testing</description>
<properties>
<java.version>1.8</java.version>
<version.junit-platform-suite>1.3.2</version.junit-platform-suite>
<version.maven.surefire>2.19.1</version.maven.surefire>
<version.thymeleaf.java8time>3.0.2.RELEASE</version.thymeleaf.java8time>
<version.spring.thymeleaf>2.3.5.RELEASE</version.spring.thymeleaf>
<selenium.version>3.3.1</selenium.version>
<selenium-htmlunit.version>2.26</selenium-htmlunit.version>
<htmlunit.version>2.26</htmlunit.version>
<version.oracle>12.1.0.2</version.oracle>
</properties>
<dependencies>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
<version>${version.thymeleaf.java8time}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>${version.spring.thymeleaf}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Oracle -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>${version.oracle}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- excel -->
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
</plugin>
</plugins>
</build>
</project>
I am using a specific (given) repository that is why some of the version is not the latest. But some of you might have an idea. I already search some similar questions but the answers is not similar to my case. Btw, I censored the ip and host just in case.
After hours of researching, I have solved this already by using Selenium Grid. Versions in pom.xml won't matter as long as you use selenium grid magic.