For the below code of setting chromeoptions using addArguments() method is giving following error
cannot access AbstractDriverOptions
options.addArguments("--disable-web-security");
^
class file for org.openqa.selenium.remote.AbstractDriverOptions not found
Code:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-web-security");
options.addArguments("--headless");
options.addArguments("--window-size=2880,1800");
options.addArguments("--start-fullscreen");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-notifications");
...
...
This code was working fine with older version of Selenium dependency but now i upgraded all my dependencies to new versions for some reasons and it's not working
Selenium Dependencies:
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.0.0-rc-1'
implementation 'org.seleniumhq.selenium:selenium-support:4.0.0-rc-1'
build.gradle:
plugins {
id 'org.springframework.boot' version '2.5.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'org.ajoberstar.grgit' version '3.1.1'
id "com.gorylenko.gradle-git-properties" version "2.3.1"
}
group = 'com.leadmi'
if (project.hasProperty('appVersion')) {
version = "${appVersion}"
} else {
version = "${version}-BRANCH-${grgit.branch.current().name}-SNAPSHOT"
}
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
ext {
set('springCloudVersion', "2020.0.3")
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
implementation 'net.logstash.logback:logstash-logback-encoder:6.6'
testImplementation 'org.springdoc:springdoc-openapi-webmvc-core:1.5.10'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.60'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation 'org.springframework.kafka:spring-kafka-test'
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.0.0-rc-1'
implementation 'org.seleniumhq.selenium:selenium-support:4.0.0-rc-1'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'me.xdrop:fuzzywuzzy:1.3.1'
implementation 'org.jsoup:jsoup:1.14.2'
implementation 'us.codecraft:xsoup:0.3.2'
implementation 'org.springframework.kafka:spring-kafka'
testImplementation 'org.springframework.kafka:spring-kafka-test'
implementation 'org.springframework.cloud:spring-cloud-starter-consul-config'
implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
Java version I'm using:
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~18.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
Chrome Version:
Google Chrome 93.0.4577.63
Chrome Driver Version:
93.0.4577.15
You miss the following dependency
implementation 'org.seleniumhq.selenium:selenium-remote-driver:4.0.0-rc-1'
As stated in the official documentation, generally we can just use
selenium-java
dependency
implementation 'org.seleniumhq.selenium:selenium-java:4.0.0-rc-1'
instead of
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.0.0-rc-1'
implementation 'org.seleniumhq.selenium:selenium-support:4.0.0-rc-1'
implementation 'org.seleniumhq.selenium:selenium-remote-driver:4.0.0-rc-1'
Reference:
Unable to set maven dependencies for RemoteWebDriver