I am a programmer new to Java world. I am using Intellij-idea, Maven, & Selenium.
I followed instructions exactly to generate Selenium Project. The link is: http://www.seleniumhq.org/docs/03_webdriver.jsp
The directions ask you to
- create project folder
- drop pom.xml they gave you into Project folder
- edit group & artifact tags of the Pom.xml
- Run “mvn clean install” command
So I am enclosing the pom.xml I used, and I followed directions above using “FWSDriverProject” as my folder (for pom.xml file, see bottom of this message).
Since I don’t have an old version of Intellij, and the directions on the Selenium site are old, I couldn’t follow them exactly, but I did notice that a jar file was created for me in target subfolder of the project, and I am familiar on how to use jar files so I thought it worth a shot.
I created folder called C:\Java\FWS_SeleniumJarConsumer & then created simple command-line app within that folder.
I added libs folder, C:\Java\FWS_SeleniumJarConsumer\libs.
Then I dropped the JAR file created for me, into this folder.
Then, within Intellij, I opened my FWS_SeleniumJarConsumer project, and I right-clicked on the jar file and selected “Add to Library”.
I was greeted with “IDEA cannot determine what kind of files the chosen items contain. Choose the appropriate categories from the list.”
It allows you to select multiple. Since I wasn't sure what to select, I chose all of them.
I didn't get any errors.
But when trying to use the imports provided in the sample code, I get error.
import org.openqa.selenium.By;
The error say: “Cannot resolve symbol openqa”
Any ideas on how to get basic Selenium project up and running using IntelliJ & Java?
I am using latest Maven and IntelliJ-idea. Tutorial on link is old.
<?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>HCFCD</groupId>
<artifactId>FWSDriver</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.21</version>
</dependency>
</dependencies>
</project>