Reputation: 871
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:
Selenium-server
as dependency --> not workingSelenium-server-standalone
as dependency --> not workingSelenium-server-standalone
by hand --> not workingSelenium-server-standalone
to the ClassPath (in Eclipse) --> workingEven 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!
Upvotes: 1
Views: 2698
Reputation: 7339
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.
Upvotes: 1