Issue
I am trying to run Selenium in a Maven project. Unfortunately the program hangs at the initialization of the WebDriver
with no error messages:
WebDriver driver = new FirefoxDriver();
Following things I already tried to fix the problem:
- adding
Selenium-server
as dependency --> not working - adding
Selenium-server-standalone
as dependency --> not working - starting
Selenium-server-standalone
by hand --> not working - adding
Selenium-server-standalone
to the ClassPath (in Eclipse) --> working
Even I found a way that my test project is working in Eclipse I still need to run everything with a 'pure' Maven project. This is due the CI integration and furthermore I like to work with Netbeans more than with Eclipse.
Another thing I figured is that everything is working when I use the headless browser (HtmlUnitDriver
).
Could somebody give me an hint to get everything running with a pure Maven project and a real browser? Thanks in advanced!
- Version Selenium-server: 2.33.0
- Version Selenium-server-standalone: 2.33.0
- Version Firefox: 21
- Version Netbeans: 7.3
- Version Eclipse: Juno Service Release 2
Solution
I use webdriver in maven project. But I use older version of it. My driver setUp :
protected static WebDriver driver;
@BeforeClass
public static void setUp() throws MalformedURLException {
DesiredCapabilities capability = DesiredCapabilities.firefox();
driver = new FirefoxDriver(); //for local check
driver.manage().window().setSize(new Dimension(1920, 1080));
}
Dependecies in POM.xml which are resposible for webDriver initialization:
<dependencies>
<dependency> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
Hope this helps you.
Answered By - eugene.polschikov