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:
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.
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.

what is that host number?
ReplyDeletehow we can find for our application or it is default one?
http://localhost:4444/wd/hub
And can we use same code in Internet explorer?
I assume you are referencing the number "4444". This is the default port number that Selenium Server runs under. Your application continues to run under its normal port which you should not have to reference unless you are not running on port 80 or port 443.
ReplyDelete