How to run Selenium WebDriver with Console Output

How to run Selenium WebDriver with Console Output

I have been asked how to run Selenium 2 WebDriver in a mode that emulates the console output window that Selenium Remote Control has. WebDriver starts up the selenium server in the background and you cannot see any error messages that might be helpful.

First start up the selenium console as you did with Selenium 1 tests:

java -jar selenium-server-standalone.x.xx.x.jar

In your test code use this:

driver = new RemoteWebDriver(new URL(“http://localhost:4444/wd/hub”),   DesiredCapabilities.firefox());
 
instead of this:
        
driver = new FirefoxDriver();
 
but of course you need to import this:
 

import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

So you will get the helpful logging that Selenium provides below:




© Copyright 2012 LMN Solutions
If you  have a question e-mail us or add a comment.

 
 
 

LMN Solutions – Find out more about us.
Selenium Training

selenium@lmnsolutions.com
Leave Yours +

No Comments

Comments are closed.

  • Comments are Closed