Just a very short demo of Selenium's WebDriver.
- Java JDK >= 7 (See Oracle JDK or OpenJDK)
- Maven 3
- Git
- Firefox
Note for Windows users: The instructions in this README are run from a console. This program is called cmd.exe
.
The program code can best be seen by another editor than notepad, since all code will be displayed on one line. Use something like Notepad++,
UltraEdit, ... or use Wordpad. Also, forward slashes in file paths /
are backward slashes \
in Windows.
Open a console. On the command line, type:
git clone https://github.com/ghsnd/webdriverdemo.git
Now there is a new directory webdriverdemo
, which contains the project source. cd
to that directory.
cd webdriver
To compile the source:
Open a console, go to the webdriverdemo
directory, and type:
mvn compile
To make a runnable jar from the compiled code:
mvn package
Now, a file target/webdriverdemo-1.0-SNAPSHOT-jar-with-dependencies.jar
should be created.
Still in the console, in the webdriverdemo
directory, type:
java -jar target/webdriverdemo-1.0-SNAPSHOT-jar-with-dependencies.jar
This launches Firefox and navigates through the NMBS website http://www.belgianrail.be
The code is in webdriverdemo/src/main/java/be/ugent/mmlab/webdriver/Demo.java
. Change the code, build, run and enjoy!