From 89f9567f28957cfaf98eba3f0cd8afbf574c5626 Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori <vmi@nifty.com> Date: Sat, 15 Aug 2020 10:59:04 +0900 Subject: [PATCH 1/5] update dependency versions. --- pom.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 65f712007..df226bf7f 100644 --- a/pom.xml +++ b/pom.xml @@ -46,10 +46,10 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de <target.version>1.8</target.version> <skipTests>true</skipTests> <selenium.version>3.141.59</selenium.version> - <htmlunit.version>2.40.0</htmlunit.version> + <htmlunit.version>2.43.0</htmlunit.version> <htmlunit-core-js.version>${htmlunit.version}</htmlunit-core-js.version> <neko-htmlunit.version>${htmlunit.version}</neko-htmlunit.version> - <htmlunit-driver.version>${htmlunit.version}</htmlunit-driver.version> + <htmlunit-driver.version>2.43.1</htmlunit-driver.version> <slf4j.version>1.7.30</slf4j.version> <maven.version.rules>file://${basedir}/version-rules.xml</maven.version.rules> <shade.java.srcdir>src/shade/java</shade.java.srcdir> @@ -393,12 +393,12 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> - <version>3.6</version> + <version>3.7</version> </dependency> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant-commons-net</artifactId> - <version>1.10.7</version> + <version>1.10.8</version> </dependency> </dependencies> </plugin> @@ -537,7 +537,7 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> - <version>4.1.49.Final</version> + <version>4.1.51.Final</version> </dependency> </dependencies> </dependencyManagement> @@ -569,17 +569,17 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.10</version> + <version>3.11</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-text</artifactId> - <version>1.8</version> + <version>1.9</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.6</version> + <version>2.7</version> </dependency> <dependency> <groupId>args4j</groupId> @@ -669,7 +669,7 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de <dependency> <groupId>com.assertthat</groupId> <artifactId>selenium-shutterbug</artifactId> - <version>0.9.3</version> + <version>1.0</version> <exclusions> <exclusion> <groupId>org.seleniumhq.selenium</groupId> From 148db569a4acb12c477b92f8941f41752208acb1 Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori <vmi@nifty.com> Date: Sat, 15 Aug 2020 11:23:46 +0900 Subject: [PATCH 2/5] follow API changes in Selenium Shutterbug 1.0. --- src/main/java/jp/vmi/selenium/selenese/Runner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/jp/vmi/selenium/selenese/Runner.java b/src/main/java/jp/vmi/selenium/selenese/Runner.java index 57a273645..f4521beb9 100644 --- a/src/main/java/jp/vmi/selenium/selenese/Runner.java +++ b/src/main/java/jp/vmi/selenium/selenese/Runner.java @@ -31,8 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.assertthat.selenium_shutterbug.core.Capture; import com.assertthat.selenium_shutterbug.core.Shutterbug; -import com.assertthat.selenium_shutterbug.utils.web.ScrollStrategy; import com.google.common.base.Strings; import jp.vmi.html.result.HtmlResult; @@ -248,7 +248,7 @@ protected String takeScreenshot(File file, boolean entirePage) throws Unsupporte Map<?, ?> initialCoord = (Map<?, ?>) je.executeScript(getScrollCoord); - Shutterbug.shootPage((WebDriver) tss, ScrollStrategy.WHOLE_PAGE, screenshotScrollTimeout) + Shutterbug.shootPage((WebDriver) tss, Capture.FULL_SCROLL, screenshotScrollTimeout) .withName(FilenameUtils.removeExtension(tmp.getName())) .save(dir.getPath()); From dffb45c391a9cf05ee29c79aaefae397ff6da78b Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori <vmi@nifty.com> Date: Sat, 15 Aug 2020 11:36:50 +0900 Subject: [PATCH 3/5] a tiny change. --- src/main/java/jp/vmi/selenium/selenese/Runner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/jp/vmi/selenium/selenese/Runner.java b/src/main/java/jp/vmi/selenium/selenese/Runner.java index f4521beb9..ab52f2a53 100644 --- a/src/main/java/jp/vmi/selenium/selenese/Runner.java +++ b/src/main/java/jp/vmi/selenium/selenese/Runner.java @@ -72,7 +72,7 @@ public class Runner implements Context, ScreenshotHandler, HighlightHandler, JUn private static final DateTimeFormatter FILE_DATE_TIME = DateTimeFormatter.ofPattern("yyyyMMdd_HHmmssSSS"); - private static PrintStream DEFAULT_PRINT_STREAM = new PrintStream(new NullOutputStream()); + private static PrintStream DEFAULT_PRINT_STREAM = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM); private PrintStream ps; private WebDriver driver = null; From 8d49644d08476a7e2dbb30ec2db5608b5df88e8d Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori <vmi@nifty.com> Date: Sat, 15 Aug 2020 14:37:38 +0900 Subject: [PATCH 4/5] fix test error due to changes in geckodriver 0.27.0. --- .travis.yml | 2 +- .../selenium/webdriver/FirefoxDriverFactoryTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d4599b90..7b67a2697 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ cache: - $HOME/.m2 install: - gd_url=https://github.com/mozilla/geckodriver/releases/download - - gd_ver=v0.21.0 + - gd_ver=v0.27.0 - ( mkdir -pv bin; cd bin ; curl -L "${gd_url}/${gd_ver}/geckodriver-${gd_ver}-linux64.tar.gz" | gunzip | tar xf - ; chmod +x geckodriver ) - mvn -B -V dependency:resolve before_script: diff --git a/src/test/java/jp/vmi/selenium/webdriver/FirefoxDriverFactoryTest.java b/src/test/java/jp/vmi/selenium/webdriver/FirefoxDriverFactoryTest.java index cab14264e..206a79bdf 100644 --- a/src/test/java/jp/vmi/selenium/webdriver/FirefoxDriverFactoryTest.java +++ b/src/test/java/jp/vmi/selenium/webdriver/FirefoxDriverFactoryTest.java @@ -6,7 +6,7 @@ import org.junit.Test; import org.junit.rules.ExternalResource; import org.junit.rules.TemporaryFolder; -import org.openqa.selenium.SessionNotCreatedException; +import org.openqa.selenium.InvalidArgumentException; import static org.openqa.selenium.firefox.FirefoxDriver.SystemProperty.*; @@ -52,14 +52,14 @@ protected void after() { * Test of not finding Firefox binary. * * @throws IOException exception. - * @throws IllegalArgumentException exception. + * @throws InvalidArgumentException exception. */ - @Test(expected = IllegalStateException.class) - public void firefoxNotFoundIn_webdriver_firefox_bin() throws IOException, IllegalArgumentException { + @Test(expected = InvalidArgumentException.class) + public void firefoxNotFoundIn_webdriver_firefox_bin() throws IOException, InvalidArgumentException { try { new FirefoxDriverFactory().newInstance(new DriverOptions()); - } catch (SessionNotCreatedException e) { - throw new IllegalStateException(e); + } catch (IllegalStateException e) { + throw new InvalidArgumentException(e.getMessage(), e); } } } From 9964481dc3dcb1fe21158787ef614e54d6039997 Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori <vmi@nifty.com> Date: Sat, 15 Aug 2020 14:43:10 +0900 Subject: [PATCH 5/5] remove the code we no longer need because the screenshot feature has been replaced by Selenium Shutterbug. (#321) --- src/main/java/jp/vmi/selenium/selenese/Runner.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/jp/vmi/selenium/selenese/Runner.java b/src/main/java/jp/vmi/selenium/selenese/Runner.java index ab52f2a53..cdd67ebad 100644 --- a/src/main/java/jp/vmi/selenium/selenese/Runner.java +++ b/src/main/java/jp/vmi/selenium/selenese/Runner.java @@ -226,13 +226,6 @@ protected String takeScreenshot(File file, boolean entirePage) throws Unsupporte if (tss == null) throw new UnsupportedOperationException("webdriver does not support capturing screenshot."); file = file.getAbsoluteFile(); - try { - // cf. http://prospire-developers.blogspot.jp/2013/12/selenium-webdriver-tips.html (Japanese) - driver.switchTo().defaultContent(); - } catch (Exception e) { - // some times switching to default context throws exceptions like: - // Method threw 'org.openqa.selenium.UnhandledAlertException' exception. - } File tmp; try { File dir = file.getParentFile();