This is a simple Selenium test example using Java and the Chrome WebDriver to automate interactions with the Guru99 Demo Website.
- Java installed on your machine
- Maven enviroment variables
- Chrome browser installed
- ChromeDriver executable downloaded and placed in the appropriate directory (in this case,
src/main/resources/drivers/
)
-
Clone the repository:
git clone https://github.com/EmilWijayasekara/Selenium-automation-testing-with-webdriver-test-01.git
-
Open the project in your preferred Java IDE.
-
Update the ChromeDriver executable path in the code if necessary:
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\src\\main\\resources\\drivers\\chromedriver.exe");
-
Run the
Example2
class to execute the Selenium test.
This Selenium test automates the following steps:
- Navigate to the Guru99 Demo Website.
- Log in with a username and password.
- Go to the flight reservation page.
- Set various flight details such as one-way trip, passenger count, departing and arriving airports, dates, service class, and airline.
- Display and print the list of available airlines.
- Find and display available flights.
- Close the browser.
-
The
Thread.sleep
statements are used for demonstration purposes and may need adjustment based on the speed of your system and network. -
Make sure to update the ChromeDriver version if necessary.
user variables for [user]
system variables