I've been looking at the distinction between webDriver.naviagate.to and webDriver.get and they seem the same.
Certainly a web page launches..but then a big nothing burger. Not sure where to start to even figure out what's happening or why.
slow-motion crash:
thufir@dur:~/NetBeansProjects/scrape$
thufir@dur:~/NetBeansProjects/scrape$ gradle run
> Task :run
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'dur', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-25-generic', java.version: '12.0.1'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:247)
at org.openqa.selenium.firefox.XpiDriverService.start(XpiDriverService.java:159)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at net.bounceme.dur.scrape.Scrape.initWebDriver(Scrape.java:37)
at net.bounceme.dur.scrape.App.runApp(App.java:28)
at net.bounceme.dur.scrape.App.main(App.java:18)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:9070/hub/status] to be available after 45010 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:245)
... 10 more
Caused by: java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 11 more
> Task :run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/home/thufir/.sdkman/candidates/java/12.0.1-zulu/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 48s
3 actionable tasks: 1 executed, 2 up-to-date
thufir@dur:~/NetBeansProjects/scrape$
code:
package net.bounceme.dur.scrape;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import java.util.logging.Logger;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import org.basex.core.Context;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Scrape {
private static final Logger LOG = Logger.getLogger(Scrape.class.getName());
private Properties properties = new Properties();
private Properties systemProperties = new Properties();
private final Context context = new Context();
private WebDriver webDriver = null;
private Scrape() {
// needs a properties file for configuration
}
public Scrape(Properties properties) {
this.properties = properties;
LOG.fine(properties.toString());
}
public void initWebDriver() throws MalformedURLException {
Path path = FileSystems.getDefault().getPath(properties.getProperty("gecko_path"));
String webdriver = properties.getProperty("webdriver");
URL url = new URL(properties.getProperty("url"));
LOG.fine(path.toString());
System.setProperty(webdriver, path.toString());
LOG.fine(System.getProperties().toString());
webDriver = new FirefoxDriver();
webDriver.get(url.toString());
LOG.info(url.toString());
}
}