I'm just getting started with selenium:
package selenium;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SeleniumWebPage {
private final static Logger log = Logger.getLogger(SeleniumWebPage.class.getName());
private final LinkFacade lf = new LinkFacade();
public SeleniumWebPage() {
}
public void processLinks() {
List<Link> links = lf.getAll();
for (Link l : links) {
processLink(l);
}
}
private void processLink(Link l) {
WebDriver driver = new FirefoxDriver(); //don't display
driver.get(l.getLink());
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
String s = driver.getPageSource();
log.info(s);
driver.close();
}
}
Apparently it's not really possible, or at least not quite the same, to run a "headless" version of WebDriver
?
In an event, Does this give all the javascript from the live page? Optimally, I would like to click links, fill in fields, etc, and then log, as above, any changes to the console.
Is it possible to achieve this with WebDriver
?
In order to click links, fill in fields and so forth, it's necessary to build some logic to parse the HTML elements?