Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
01fdbd1
Updating dependencies to the latest versions
barancev Feb 28, 2013
2094157
Updating operadriver version
barancev Mar 1, 2013
a2f20fb
Using more typical names for driver and baseUrl
barancev Mar 7, 2013
c95b2df
Fixing another use of webDriver field
barancev Mar 7, 2013
076c0cb
Fixing another use of webDriver field
barancev Mar 7, 2013
3c7a09a
Merge branch 'master' of https://github.com/barancev/Selenium2-Java-Q…
barancev Mar 7, 2013
96fee9f
Making WebDriver factory to use the singleton driver object for local
barancev Mar 7, 2013
0c434e2
Updating OperaDriver version to 1.2
barancev Mar 9, 2013
71769eb
Normalizing line endings
barancev Mar 9, 2013
800a0c3
Fixing link to the repository in the instruction
barancev Mar 10, 2013
5e71172
Adding Safari support
barancev Mar 12, 2013
44f8b04
Changing mind to use an external chromedriver
barancev Mar 12, 2013
4ad5a57
Fixing SafariDriver class name
barancev Mar 19, 2013
a7c28be
Updating versions of selenium and other dependencies
barancev Apr 17, 2013
0bc082c
Fixed version number in the documentation
barancev Apr 21, 2013
f316ebb
Updating versions of selenium (2.33) and operadriver (1.3)
barancev May 27, 2013
5424775
Updated for 2.35
barancev Aug 15, 2013
727dbb9
1) Added support for PhantomJS, 2) Updated OperaDriver to 1.5
barancev Aug 23, 2013
b147208
Updated for 2.37
barancev Oct 31, 2013
db8df30
Updated to 2.40
barancev Feb 26, 2014
f201e83
Ignoring IDEA project files
barancev Feb 28, 2014
146faf9
Enriching POM
barancev Feb 28, 2014
d8cb0b3
Removing use of IPhoneDriver and AndroidDriver
barancev Mar 1, 2014
5822fed
Updating version number
barancev Mar 1, 2014
81af1c4
Updating docs
barancev Mar 1, 2014
35ddd3f
Removing imports for IPhoneDriver and AndroidDriver
barancev Mar 1, 2014
887a9e0
Updating formatting
barancev Mar 21, 2014
ea210a5
Updating to use ru.stqa:webdriver-factory
barancev Mar 21, 2014
37d67c5
Upgraded to 2.43.1
barancev Feb 15, 2015
4c9fed6
Update README.md
barancev Feb 15, 2015
69bb0a1
Merge branch 'master' of https://github.com/barancev/webdriver-java-q…
barancev Jun 29, 2015
8ea10ed
Upgrading to Selenium 2.46
barancev Jun 29, 2015
199297b
Update README.md
barancev Sep 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
/.project
/.settings
/.classpath
/.classpath
/.idea
/*.iml
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Selenium2 Java QuickStart Archetype
Copyright 2011 sebarmeli
WebDriver Java QuickStart Archetype
Copyright 2013-2014 Alexei Barantsev [email protected]

This product includes software developed by
Sebastiano Armeli-Battana
Expand Down
80 changes: 1 addition & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1 @@
Introduction
============

This archetype generates a small Maven project with Selenium 2 and TestNG embedded to make it easy to get started testing with Selenium Web Driver.

This project provides just a starting point to get up to speed with Selenium 2 infrastructure.

To install the archetype in your local repo:

git clone git://github.com/sebarmeli/Selenium2-Java-QuickStart-Archetype.git
cd Selenium2-Java-Quickstart-Archetype
mvn install

Now, you can use the archetype in a new project typing:

mvn archetype:generate -DarchetypeGroupId=com.sebarmeli -DarchetypeArtifactId=selenium2-java-quickstart-archetype -DarchetypeVersion=0.2 -DgroupId=<mygroupId> -DartifactId=<myartifactId>

where *mygroupId* : group id of the project you are creating; *myartifactId* : artifact id of the project you are creating

It uses Java bindings for Selenium version 2.12.0, OperaDriver version 0.7.3 and TestNG version 6.3.


Project Structure
-----------------------------------

The project follows the standard Maven structure, so all the tests go in the *src/test/java* folder. Tests should inherit from the **TestBase** class. In this class a factory method
from **WebDriverFactory** class is in charge of generating the instance of the WebDriver interface you need. Different parameters are passed into the factory:

* base URL : base URL of the AUT (application under test)
* Grid 2 hub URL : URL of the hub (if using Grid 2)
* browser fatures: a) name b) version c) platform
* username / password : in case of BASIC authenticated site

Those parameters are retrieved from the *src/main/resources/application.properties* file. You can also populate the properties file from command line (through -D<property in mvn command or through
Hudson/Jenkins).

**TestBase** class provides 30 seconds as interval for polling element from the DOM (implicity wait), and also it takes care of closing the driver when all the tests are executed in the suite.
(Feel free to update all this values according to your needs)

**HomePageTest** class (in *src/test/java/pages*) is just an example of a test class for testing the homepage of a web application. This test class accepts the *path* parameter
(set in *src/test/resources/testng.xml)* defining the path appended to the base URL (in case of the home page, usually just "/"). In the setup method of this class, the **PageFactory** class is used
to help supporting the **PageObject** pattern (see below for more information). Briefly according to this pattern, each page is an object. *src/main/java/pages/HomePage* class is an example of
a class representing the home page. Notice how the constructor accepts the "WebDriver" interface as parameter and all the "services" available for that page should be exposed here. It also allows to
decouple the DOM element from the functionalities offered by the page.


In the TestBase class, I commented out the method launched after the suite runs and it takes screenshots in case of failure. Feel free to uncomment it out if you need and if your driver supports that
funcitonality. (at the moment it's not supported on mobile devices)


Adding Chrome Driver to the project
-----------------------------------

If you need to use chromedriver, you should put the proper driver file downloaded from http://code.google.com/p/chromium/downloads/list into *src/main/resources/drivers/chrome*. If you are on Windows, the file should be named *chromedriver.exe*,
if on Unix-based system, the file should be named *chromedriver*.


TestNG
------
For more info around TestNG framework, go to http://testng.org/doc/index.html. If you prefer, you could substitute this framework with JUnit.


Page Object pattern
-------------------
For more info around this pattern, read this wiki page: http://code.google.com/p/selenium/wiki/PageObjects


Integration with SauceLabs
-------------------
You can easily integrate the project with SauceLabs, great service to launch tests in the cloud. You need to retrieve your SauceLab key and setting the "grid2.hub" property with thid syntax:
*http://<username>:<token>@ondemand.saucelabs.com:80/wd/hub*

Further Notes
-------
The project is just a starting point, feel free to modify it according to your needs.

Credits
-------
The selenium2-java-quickstart-archetype project is an open source project licensed under the Apache License 2.0.
Deprecated in favor of https://github.com/barancev/webdriver-testng-archetype and https://github.com/barancev/webdriver-junit-archetype
8 changes: 0 additions & 8 deletions changelog.txt

This file was deleted.

112 changes: 70 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,72 @@
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may obtain
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<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>com.sebarmeli</groupId>
<artifactId>selenium2-java-quickstart-archetype</artifactId>
<version>0.2</version>
<name>Selenium2 Java QuickStart Archetype</name>
<packaging>maven-archetype</packaging>
<description>Generates a QuickStart project with Selenium 2 and TestNG</description>
<properties>
<archetype.version>2.1</archetype.version>
</properties>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${archetype.version}</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>${archetype.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>
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>ru.stqa.selenium</groupId>
<artifactId>webdriver-java-quickstart-archetype</artifactId>
<version>0.8</version>
<packaging>maven-archetype</packaging>

<name>WebDriver Java QuickStart Archetype</name>
<description>Generates a QuickStart project with WebDriver and TestNG</description>
<url>https://github.com/barancev/webdriver-java-quickstart-archetype</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<archetype.version>2.2</archetype.version>
</properties>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<scm>
<connection>scm:git:https://github.com/barancev/webdriver-java-quickstart-archetype</connection>
<developerConnection>scm:git:https://github.com/barancev/webdriver-java-quickstart-archetype</developerConnection>
<url>https://github.com/barancev/webdriver-java-quickstart-archetype</url>
</scm>

<developers>
<developer>
<id>barancev</id>
<name>Alexei Barantsev</name>
<roles>
<role>Owner</role>
</roles>
</developer>
</developers>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${archetype.version}</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>${archetype.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

</project>
3 changes: 0 additions & 3 deletions src/main/resources/META-INF/maven/archetype-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
</fileSet>
<fileSet>
<directory>src/main/resources/drivers/chrome/</directory>
</fileSet>
<fileSet>
<directory>src/main/resources/grid2</directory>
</fileSet>
Expand Down
Loading