Skip to content

Commit

Permalink
Merge pull request #341 from vmi/update_deps_20230319
Browse files Browse the repository at this point in the history
Catch up Selenium 4.8.1 and update dependency versions.
  • Loading branch information
vmi authored Mar 21, 2023
2 parents b9a7f7d + ae17e48 commit cf6acf4
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 32 deletions.
6 changes: 6 additions & 0 deletions RELEASENOTE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Selenese Runner Java Relase Note
================================

### 4.3.0

* Catch up Selenium 4.8.1 and update dependency versions.
* Fix several problems associated with the update.
* Remove dependency on `xalan` for security reason. (#337)

### 4.2.0

* Catch up Selenium 4.4.0 and update dependency versions.
Expand Down
28 changes: 9 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
<source.version>1.8</source.version>
<target.version>1.8</target.version>
<skipTests>true</skipTests>
<selenium.version>4.4.0</selenium.version>
<htmlunit.version>2.63.0</htmlunit.version>
<selenium.version>4.8.1</selenium.version>
<htmlunit.version>2.70.0</htmlunit.version>
<htmlunit-core-js.version>${htmlunit.version}</htmlunit-core-js.version>
<neko-htmlunit.version>${htmlunit.version}</neko-htmlunit.version>
<htmlunit-driver.version>3.63.0</htmlunit-driver.version>
<slf4j.version>1.7.36</slf4j.version>
<htmlunit-driver.version>4.8.0</htmlunit-driver.version>
<slf4j.version>2.0.7</slf4j.version>
<maven.version.rules>file://${basedir}/version-rules.xml</maven.version.rules>
<shade.java.srcdir>src/shade/java</shade.java.srcdir>
<shade.java.destdir>target/shade-classes</shade.java.destdir>
Expand Down Expand Up @@ -390,7 +390,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.10.12</version>
<version>1.10.13</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -513,11 +513,6 @@
<artifactId>htmlunit-driver</artifactId>
<version>${htmlunit-driver.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.79.Final</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -573,12 +568,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.2</version>
<version>1.3.6</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Expand All @@ -593,12 +583,12 @@
<dependency>
<groupId>com.floreysoft</groupId>
<artifactId>jmte</artifactId>
<version>7.0.0</version>
<version>7.0.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -664,7 +654,7 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.6</version>
<version>2.3.8</version>
</dependency>
</dependencies>
<reporting>
Expand Down
9 changes: 8 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ do_script() {
local file="$1"; shift
set -x
case "$OSTYPE" in
linux*|cygwin*)
linux*)
script -c "$*" "$file"
;;
cygwin*)
cmd=""
for a in "$@"; do
cmd="$cmd '$a'"
done
script -c "${cmd# }" "$file"
;;
darwin*|*bsd*)
script "$file" "$@"
;;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/jp/vmi/selenium/selenese/log/CookieMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* Map of Cookies.
*/
@SuppressWarnings("serial")
public class CookieMap extends TreeMap<CookieKey, CookieValue> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import javax.xml.transform.TransformerException;

import org.apache.xpath.XPathAPI;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import javax.xml.transform.TransformerException;

import org.apache.xpath.XPathAPI;
import org.cyberneko.html.parsers.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import javax.xml.transform.TransformerException;

import org.apache.commons.io.FilenameUtils;
import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;

Expand Down
57 changes: 57 additions & 0 deletions src/main/java/jp/vmi/selenium/selenese/parser/XPathAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package jp.vmi.selenium.selenese.parser;

import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
* org.apache.xpath.XPathAPI alternative.
*/
public class XPathAPI {

/**
* Select single node.
*
* @param document XML document.
* @param query query
* @return node
* @throws TransformerException exception.
*/
public static Node selectSingleNode(Document document, String query) throws TransformerException {
XPathFactory f = XPathFactory.newInstance();
XPath xPath = f.newXPath();
try {
XPathExpression expr = xPath.compile(query);
return (Node) expr.evaluate(document, XPathConstants.NODE);
} catch (XPathExpressionException e) {
throw new TransformerException(e);
}
}

/**
* Select node list.
*
* @param document XML document.
* @param query query
* @return list of node
* @throws TransformerException exception.
*/
public static NodeList selectNodeList(Document document, String query) throws TransformerException {
XPathFactory f = XPathFactory.newInstance();
XPath xPath = f.newXPath();
try {
XPathExpression expr = xPath.compile(query);
return (NodeList) expr.evaluate(document, XPathConstants.NODESET);
} catch (XPathExpressionException e) {
throw new TransformerException(e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public String getBrowserName() {
*/
public static ChromeOptions newChromeOptions(DriverOptions driverOptions) {
ChromeOptions options = new ChromeOptions();
if (driverOptions.has(HEADLESS))
options.setHeadless(driverOptions.getBoolean(HEADLESS));
options.addArguments("--remote-allow-origins=*"); // FIXME
if (driverOptions.has(HEADLESS) && driverOptions.getBoolean(HEADLESS))
options.addArguments("--headless=new");
Proxy proxy = newProxy(driverOptions);
if (proxy != null)
options.setProxy(proxy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public String getBrowserName() {
*/
public static FirefoxOptions newFirefoxOptions(DriverOptions driverOptions) {
FirefoxOptions options = new FirefoxOptions();
if (driverOptions.has(HEADLESS))
options.setHeadless(driverOptions.getBoolean(HEADLESS));
if (driverOptions.has(HEADLESS) && driverOptions.getBoolean(HEADLESS))
options.addArguments("--headless");
Proxy proxy = newProxy(driverOptions);
if (proxy != null)
options.setProxy(proxy);
Expand Down Expand Up @@ -79,7 +79,7 @@ public WebDriver newInstance(DriverOptions driverOptions) {
public static void setDriverSpecificCapabilitiesForRemoteWebDriver(DesiredCapabilities caps, DriverOptions driverOptions) {
String firefoxBin = getFirefoxBinary(driverOptions);
if (firefoxBin != null) {
caps.setCapability(FirefoxDriver.Capability.BINARY, firefoxBin);
caps.setCapability(FirefoxDriver.SystemProperty.BROWSER_BINARY, firefoxBin);
log.info("Firefox binary: {}", firefoxBin);
}
if (driverOptions.has(CLI_ARGS))
Expand All @@ -91,7 +91,7 @@ public static void setDriverSpecificCapabilitiesForRemoteWebDriver(DesiredCapabi
setProxyConfiguration(profile, driverOptions);
}
if (profile != null) {
caps.setCapability(FirefoxDriver.Capability.PROFILE, profile);
caps.setCapability(FirefoxDriver.SystemProperty.BROWSER_PROFILE, profile);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/jp/vmi/selenium/testutils/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public static List<Object[]> getWebDriverFactories() {
HTMLUNIT,
FIREFOX,
CHROME,
IE,
EDGE,
// IE,
// SAFARI, // FIXME: On Selenium 2.46.0, SafariDriver does not work.
};
} else {
Expand Down
7 changes: 6 additions & 1 deletion tools/classpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ cd "$(dirname "$0")/.."

# set classpath separator
if [ "$OSTYPE" != "cygwin" ]; then
ps="/"
sep=":"
pwd="$PWD"
else
ps='\'
sep=";"
pwd="$(cygpath -aw .)"
fi

# find MD5 sum command.
Expand All @@ -26,6 +30,7 @@ if [ -z "$md5sum" ]; then
fi

# generate classpath from pom.xml.
mkdir -p tmp
cp_conf="tmp/cp.conf"
pom_xml_md5="tmp/pom.xml.md5"
$md5sum pom.xml > "$pom_xml_md5.new"
Expand All @@ -37,4 +42,4 @@ else
mvn -Dmdep.outputFile="$cp_conf" dependency:build-classpath
mv "$pom_xml_md5.new" "$pom_xml_md5"
fi
echo "$PWD/target/classes${sep}$PWD/target/test-classes${sep}$(< "$cp_conf")"
echo "${pwd}${ps}target${ps}classes${sep}${pwd}${ps}target${ps}test-classes${sep}$(< "$cp_conf")"
5 changes: 5 additions & 0 deletions version-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<ignoreVersion type="regex">[3-9]\..+|\d\d.+|\d+(\.\d+)+-[bM][\d.]+|3\..+</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="ch.qos.logback" artifactId="logback-classic">
<ignoreVersions>
<ignoreVersion type="regex">1\.([4-9]|[0-9][0-9]).*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="junit" artifactId="junit">
<ignoreVersions>
<ignoreVersion type="regex">.*-rc-\d+</ignoreVersion>
Expand Down

0 comments on commit cf6acf4

Please sign in to comment.