<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Selenium – maven</title><link>https://trunk--polite-jelly-cc0866.netlify.app/tags/maven/</link><description>Recent content in maven on Selenium</description><generator>Hugo -- gohugo.io</generator><lastBuildDate>Tue, 25 Jan 2011 00:00:00 +0000</lastBuildDate><atom:link href="https://trunk--polite-jelly-cc0866.netlify.app/tags/maven/index.xml" rel="self" type="application/rss+xml"/><item><title>Blog: 2.0b1 and Maven</title><link>https://trunk--polite-jelly-cc0866.netlify.app/blog/2011/2-0b1-and-maven/</link><pubDate>Tue, 25 Jan 2011 00:00:00 +0000</pubDate><guid>https://trunk--polite-jelly-cc0866.netlify.app/blog/2011/2-0b1-and-maven/</guid><description>
&lt;p>If you’re using Maven and the 2.0b1 release of Selenium, you may be running into some problems getting maven to pick up your tests. The underlying problem is that selenium contains support classes for both JUnit and TestNG. The solution is to add this to your pom.xml&lt;/p>
&lt;pre tabindex="0">&lt;code>&amp;lt;dependency&amp;gt;
&amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;selenium&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;2.0b1&amp;lt;/version&amp;gt;
&amp;lt;exclusions&amp;gt;
&amp;lt;exclusion&amp;gt;
&amp;lt;groupId&amp;gt;org.testng&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;testng&amp;lt;/artifactId&amp;gt;
&amp;lt;/exclusion&amp;gt;
&amp;lt;/exclusions&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code>&lt;/pre></description></item><item><title>Blog: How to use Selenium 2 with Maven</title><link>https://trunk--polite-jelly-cc0866.netlify.app/blog/2010/how-to-use-selenium-2-with-maven/</link><pubDate>Fri, 30 Jul 2010 00:00:00 +0000</pubDate><guid>https://trunk--polite-jelly-cc0866.netlify.app/blog/2010/how-to-use-selenium-2-with-maven/</guid><description>
&lt;p>There are several ways to use Selenium 2:&lt;/p>
&lt;ol>
&lt;li>If you don’t have Selenium 1.x legacy code, you might want to directly use on of the new WebDriver implemenations like ChromeDriver, HtmlUnitDriver, FirefoxDriver, or InternetExplorerDriver which provide a nice, small and easy to learn API.&lt;/li>
&lt;li>If you have Selenium 1.x legacy code, you can still use the well known DefaultSelenium class or the new WebDriverBackedSelenium, which extends DefaultSelenium but uses one of the WebDriver implementations internally.&lt;/li>
&lt;/ol>
&lt;p>Whichever option you prefer, if you have want to use Maven, all you need to do is add the following dependency to your pom.xml:&lt;/p>
&lt;pre>&lt;code>&amp;lt;dependency&amp;gt;
&amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;selenium&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;2.0a5&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>If you know, that you will only use a certain WebDriver implementation, e.g. the FirefoxDriver, you don’t need to depend on the selenium artifact (which has dependencies to all WebDriver implementations as well as the support classes). Instead you can add the dependency to just the artifact you need, e.g.&lt;/p>
&lt;pre>&lt;code>&amp;lt;dependency&amp;gt;
&amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;selenium-firefox-driver&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;2.0a5&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>When using a WebDriver implementation, there is no need to start a Selenium server – the browser will be directly started and remote controlled.&lt;/p>
&lt;p>But if you are using DefaultSelenium (or the RemoteWebDriver implementation), you still need to start a Selenium server.&lt;/p>
&lt;p>The best way is to download the &lt;a href="http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.0a5.jar">standalone Selenium server jar&lt;/a> and just use it.&lt;/p>
&lt;p>Furthermore you can also embed the Selenium server into your own project, if you add the following dependency to your pom.xml:&lt;/p>
&lt;pre>&lt;code>&amp;lt;dependency&amp;gt;
&amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;selenium-server&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;2.0a5&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Now you can create a SeleniumServer instance yourself and start it.&lt;/p>
&lt;p>Be aware, that the selenium-server artifact has a dependency to the servlet-api-2.5 artifact, which you need to exclude, if your project will be run in a web application container.&lt;/p>
&lt;p>Well, I hope that covers everything you need to know on how to use Selenium 2 with Maven.&lt;/p>
&lt;p>Michael&lt;/p></description></item></channel></rss>