Skip to content

Commit

Permalink
[BqvAC2FK] Update selenium dependencies (#3663)
Browse files Browse the repository at this point in the history
* [BqvAC2FK] Update selenium dependencies

* [BqvAC2FK] solve deps conflicts

* [BqvAC2FK] removed ext. dep

* [BqvAC2FK] add testImplementation dep.
  • Loading branch information
vga91 committed Aug 30, 2023
1 parent 4dbe46d commit f0a3a1a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
8 changes: 5 additions & 3 deletions extra-dependencies/selenium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jar {
}

dependencies {
// currently we cannot update to the latest version due to guava minimum version required (31.0.1-jre)
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59', {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.10.0' , {
exclude group: 'com.google.guava', module: 'guava'
}
compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '4.4.3'
compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.4.0', {
exclude group: 'com.google.guava', module: 'guava'
}

}
17 changes: 13 additions & 4 deletions full/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ dependencies {
compile 'org.jsoup:jsoup:1.15.3'

// currently we cannot update selenium to the latest version due to guava minimum version required (31.0.1-jre)
compileOnly group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59', { exclude group: 'com.google.guava', module: 'guava' }
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59', { exclude group: 'com.google.guava', module: 'guava' }
compileOnly group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.1.0'
testCompile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.1.0'
compileOnly group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.10.0', {
exclude group: 'com.google.guava', module: 'guava'
}
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.10.0', {
exclude group: 'com.google.guava', module: 'guava'
}
compileOnly group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.4.0', {
exclude group: 'com.google.guava', module: 'guava'
}
testCompile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.4.0', {
exclude group: 'com.google.guava', module: 'guava'
}

compile group: 'org.roaringbitmap', name: 'RoaringBitmap', version: '0.7.17'
compile(group: 'org.apache.commons', name: 'commons-configuration2', version: '2.9.0') {
Expand Down Expand Up @@ -170,6 +178,7 @@ dependencies {
compileOnly group: 'com.sun.mail', name: 'javax.mail', version: '1.6.0'
testCompile group: 'com.sun.mail', name: 'javax.mail', version: '1.6.0'
testCompile group: 'org.zapodot', name: 'embedded-ldap-junit', version: '0.9.0'
testCompile group: 'org.mockito', name: 'mockito-core', version: '5.4.0'

configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-nop'
Expand Down
2 changes: 1 addition & 1 deletion full/src/main/java/apoc/load/LoadHtml.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private Stream<MapResult> readHtmlPage(String url, Map<String, String> query, Ma
} catch (UnsupportedCharsetException e) {
throw new RuntimeException("Unsupported charset: " + config.getCharset());
} catch (IllegalArgumentException | ClassCastException e) {
throw new RuntimeException("Invalid config: " + config);
throw new RuntimeException("Invalid config: " + e.getMessage());
} catch (FileNotFoundException e) {
throw new RuntimeException("File not found from: " + url);
} catch(Exception e) {
Expand Down
7 changes: 4 additions & 3 deletions full/src/main/java/apoc/load/LoadHtmlBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.util.Map;

import static java.util.Optional.ofNullable;
Expand All @@ -44,7 +45,7 @@ public static InputStream getChromeInputStream(String url, Map<String, String> q
setupWebDriverManager(WebDriverManager.chromedriver(), config);

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setHeadless(isHeadless);
chromeOptions.addArguments("--headless=new");
chromeOptions.setAcceptInsecureCerts(isAcceptInsecureCerts);
return getInputStreamWithBrowser(url, query, config, new ChromeDriver(chromeOptions));
}
Expand All @@ -53,7 +54,7 @@ public static InputStream getFirefoxInputStream(String url, Map<String, String>
setupWebDriverManager(WebDriverManager.firefoxdriver(), config);

FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setHeadless(isHeadless);
firefoxOptions.addArguments("-headless");
firefoxOptions.setAcceptInsecureCerts(isAcceptInsecureCerts);
return getInputStreamWithBrowser(url, query, config, new FirefoxDriver(firefoxOptions));
}
Expand Down Expand Up @@ -150,7 +151,7 @@ private static InputStream getInputStreamWithBrowser(String url, Map<String, Str

final long wait = config.getWait();
if (wait > 0) {
Wait<WebDriver> driverWait = new WebDriverWait(driver, wait);
Wait<WebDriver> driverWait = new WebDriverWait(driver, Duration.ofSeconds(wait));
try {
driverWait.until(webDriver -> query.values().stream()
.noneMatch(selector -> webDriver.findElements(By.cssSelector(selector)).isEmpty()));
Expand Down

0 comments on commit f0a3a1a

Please sign in to comment.