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) {

    private void processLink(Link l) {
        WebDriver driver = new FirefoxDriver();  //don't display
        driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
        String s = driver.getPageSource();

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?

  • 1
    installationpage.com/selenium/… – Imre L Oct 6 '14 at 12:32
  • Do you want just get the HTML and JavaScript code and test them? In this case, you should not use Selenium. Use HTMLUnit, it is a headless web browser and you can also develop your tests in Java. – Twaldigas Oct 6 '14 at 15:19
  • For now, I like watching it run. JavaScript, dynamic content is what I'm after. Ajax, content. – Thufir Oct 6 '14 at 17:43

Yes, you can run headless with either Headless Chromium or with PhantomJS ..

Keep in mind that running with Selenium Grid or SauceLabs is equally as good as running headless.

  • there's a firefox equivalent? Or, that would be SeleniumGrid? – Thufir Oct 13 '14 at 19:29
  • I don't know of a Firefox equivilant except via the service that they call BlazeMeter . Otherwise, Selenium Grid is the only way. There is also a way to do detached sessions in Linux using XVFB but its probably really technical. – djangofan Oct 15 '14 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.