First project with maven + selenium + IntelliJ

5,239 views
Skip to first unread message

Aleksandar

unread,
Jul 5, 2012, 4:47:06 PM7/5/12
to seleniu...@googlegroups.com
Hi, 

I am trying to set up my first project with selenium + maven + IntelliJ.
So as first step i followed
then i added my project into IntelliJ by following 

I didn't do anything outside what is written in thous two pages but when I build the project there is an error message

The only thing i have in my class is:
error: cannot access RemoteWebDriver
class file for org.openqa.selenium.remote.RemoteWebDriver not found

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;

public class MyAppHomePageTest
{
    public static void main(String[] args)
    {
        WebDriver driver;
        driver = new FirefoxDriver();
    }
}

What could be the problem, i Maven should have downloaded all dependencies?

My pom file is as the example (http://seleniumhq.org/docs/appendix_installing_java_driver_client.html) so this should work or the documentation on the seleniumhq.org is incorrect.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>MySel20Proj</groupId>
        <artifactId>MySel20Proj</artifactId>
        <version>1.0</version>
        <dependencies>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>2.24.1</version>
            </dependency>
            <dependency>
                <groupId>com.opera</groupId>
                <artifactId>operadriver</artifactId>
            </dependency>
        </dependencies>
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>com.opera</groupId>
                    <artifactId>operadriver</artifactId>
                    <version>0.14</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.seleniumhq.selenium</groupId>
                            <artifactId>selenium-remote-driver</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </dependencyManagement>
</project>

I just need one working example to start with my first steep (to create a call to the browser) after that it will be easy.

Thank you

Mark Collin

unread,
Jul 5, 2012, 5:00:44 PM7/5/12
to seleniu...@googlegroups.com

I have a Selenium maven template available here, give it a go:

 

https://github.com/Ardesco/Selenium-Maven-Template

 

Your POM looks fine, although you are using selenium-java, rather than selenium-server so you aren’t pulling down everything available (You should be pulling down enough to write and run tests though).

 

I don’t know if you have things in the correct maven file structure, the above template will show you what that is if you aren’t sure (as will the maven documentation)

 

Have you performed a maven reimport in IntelliJ IDEA?

 

To do this click on the “Maven Projects” tab on the right side of the IDE and then the refresh icon on the top left of the box that has opened up.  This will sync IDEA with your local maven repo (Or download the dependencies if you don’t have them in your local Maven repo).

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/DhdO-rfpeAQJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Aleksandar

unread,
Jul 6, 2012, 12:28:11 PM7/6/12
to seleniu...@googlegroups.com
Thanks, yore example works. 

Do you by any chance have a step by step instructions how to get to the stage you are in the project you sent me?
I understand the code part I just need the setup instructions how to get to the section where you can actually start writing yore code.

Thanks
Aleksandar

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Mark Collin

unread,
Jul 6, 2012, 6:16:40 PM7/6/12
to seleniu...@googlegroups.com

The setup is literally create the POM file and the directory structure as shown in the example project.  Nothing more, nothing less.

 

Maven has a specific directory structure as described here:

 

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

 

The POM file I’m using is pretty minimal; it just has dependencies on selenium, opera driver and junit (as I use junit and not TestNG).  For details on getting started with maven have a look here:

 

http://maven.apache.org/guides/getting-started/index.html

 

The template is basically designed to give you a POM with the basic maven structure pre-configured so that you can just add in new test cases, the only thing you would probably want to do is delete the com.lazerycode.selenium package and create your own package structure (the convention for the package structure is your domain in reverse, so www.google.com would become a package called com.google.www) and then create your own java class files that have tests.

 

If there is anything specific I have missed that you want clarified, let me know.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Aleksandar
Sent: 06 July 2012 17:28
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] First project with maven + selenium + IntelliJ

 

Thanks, yore example works. 

 

Do you by any chance have a step by step instructions how to get to the stage you are in the project you sent me?

I understand the code part I just need the setup instructions how to get to the section where you can actually start writing yore code.

 

Thanks

Aleksandar

On Thursday, July 5, 2012 11:00:44 PM UTC+2, Mark Collin wrote:

I have a Selenium maven template available here, give it a go:

 

https://github.com/Ardesco/Selenium-Maven-Template

 

Your POM looks fine, although you are using selenium-java, rather than selenium-server so you aren’t pulling down everything available (You should be pulling down enough to write and run tests though).

 

I don’t know if you have things in the correct maven file structure, the above template will show you what that is if you aren’t sure (as will the maven documentation)

 

Have you performed a maven reimport in IntelliJ IDEA?

 

To do this click on the “Maven Projects” tab on the right side of the IDE and then the refresh icon on the top left of the box that has opened up.  This will sync IDEA with your local maven repo (Or download the dependencies if you don’t have them in your local Maven repo).

 

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TuADFmRzASgJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

Aleksandar

unread,
Jul 7, 2012, 5:30:41 AM7/7/12
to seleniu...@googlegroups.com
Thank you for yore detail explanation, one more question.

You don't actually use something like: 
mvn clean install

Because I thought that once yo use the mvn install, mnv will actually create the folder structure.. 

I was following the instruction on the maven hope page and they always have create the pom and then use install command, then import it in the Eclipse or IntelliJ. But if I do that and try to build my project through Eclipse or IntelliJ won't build (there will be a lot of errors)

Thanks
Aleksandar


To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TuADFmRzASgJ.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Krishnan Mahadevan

unread,
Jul 7, 2012, 5:36:26 AM7/7/12
to seleniu...@googlegroups.com
Mvn clean install is actually used to clear your target directory (where all your .class files reside) then do
1. Compilation
2. Run unit tests
3. Create a jar file of your project
4. Deploy it to your local maven repo (~/.m2)

I dont know about Intellij but in eclipse you would need the eclipse maven plugin in order to be able to build a maven project. 
Have you installed it in eclipse?
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Imp2Mrwwq5kJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Aleksandar

unread,
Jul 7, 2012, 5:41:34 AM7/7/12
to seleniu...@googlegroups.com
Yes, I did install the eclipse plugin for Maven and IntelliJ has a built in support for Maven.

Ok will start without actually building the solution in Maven, will follow Marks approach and once I get a little more familiar with Maven will try to actually use it in other ways.

Thanks for the reply

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Mark Collin

unread,
Jul 7, 2012, 7:56:39 AM7/7/12
to seleniu...@googlegroups.com

No you have to create the project structure manually, you can have a non standard project structure for maven and modify the file paths in your POM but it’s not something you should do really if you want people with maven experience to know where everything is.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Aleksandar
Sent: 07 July 2012 10:31
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] First project with maven + selenium + IntelliJ

 

Thank you for yore detail explanation, one more question.

 

You don't actually use something like: 

mvn clean install


Because I thought that once yo use the mvn install, mnv will actually create the folder structure.. 

 

I was following the instruction on the maven hope page and they always have create the pom and then use install command, then import it in the Eclipse or IntelliJ. But if I do that and try to build my project through Eclipse or IntelliJ won't build (there will be a lot of errors)

 

Thanks

Aleksandar

 

 

On Saturday, July 7, 2012 12:16:40 AM UTC+2, Mark Collin wrote:

The setup is literally create the POM file and the directory structure as shown in the example project.  Nothing more, nothing less.

 

Maven has a specific directory structure as described here:

 

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

 

The POM file I’m using is pretty minimal; it just has dependencies on selenium, opera driver and junit (as I use junit and not TestNG).  For details on getting started with maven have a look here:

 

http://maven.apache.org/guides/getting-started/index.html

 

The template is basically designed to give you a POM with the basic maven structure pre-configured so that you can just add in new test cases, the only thing you would probably want to do is delete the com.lazerycode.selenium package and create your own package structure (the convention for the package structure is your domain in reverse, so www.google.com would become a package called com.google.www) and then create your own java class files that have tests.

 

If there is anything specific I have missed that you want clarified, let me know.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Aleksandar
Sent: 06 July 2012 17:28
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] First project with maven + selenium + IntelliJ

 

Thanks, yore example works. 

 

Do you by any chance have a step by step instructions how to get to the stage you are in the project you sent me?

I understand the code part I just need the setup instructions how to get to the section where you can actually start writing yore code.

 

Thanks

Aleksandar

On Thursday, July 5, 2012 11:00:44 PM UTC+2, Mark Collin wrote:

I have a Selenium maven template available here, give it a go:

 

https://github.com/Ardesco/Selenium-Maven-Template

 

Your POM looks fine, although you are using selenium-java, rather than selenium-server so you aren’t pulling down everything available (You should be pulling down enough to write and run tests though).

 

I don’t know if you have things in the correct maven file structure, the above template will show you what that is if you aren’t sure (as will the maven documentation)

 

Have you performed a maven reimport in IntelliJ IDEA?

 

To do this click on the “Maven Projects” tab on the right side of the IDE and then the refresh icon on the top left of the box that has opened up.  This will sync IDEA with your local maven repo (Or download the dependencies if you don’t have them in your local Maven repo).

 

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TuADFmRzASgJ.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Imp2Mrwwq5kJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

Aleksandar

unread,
Jul 7, 2012, 12:43:37 PM7/7/12
to seleniu...@googlegroups.com
Great, thank you one more time, I think will be able to continue from here. 

Kind Regards
Aleksandar

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TuADFmRzASgJ.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Imp2Mrwwq5kJ.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

aseem marwaha

unread,
Feb 2, 2017, 9:56:13 PM2/2/17
to Selenium Users
i am struggling with issue since weeks now and dont really have a clue to how to fix it. and i am a newbie in this space. any suggestion will be really appreciated.

⇜Krishnan Mahadevan⇝

unread,
Feb 2, 2017, 9:59:43 PM2/2/17
to Selenium Users
Aseem
You should start reading from here : http://www.seleniumhq.org/docs/03_webdriver.jsp

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages