Submtted by | |
---|---|
Name: | Chandrashekhar Tripathi |
Batch: | B.Tech CSE 4th Year |
Insitute: | NIT Arunachal Pradesh |
Find video demo of given testcase and source code on google drive
-
Clone the project
-
Download Chrome and ChromeDriver for your operating system from here
-
Extract the ChromeDriver and set the
CHROME_DRIVER_PATH
environment variable to the path of the ChromeDriver.- In Bash (linux or MacOS)
export CHROME_DRIVER_PATH=/path/to/chromedriver
- In Powershell (Windows)
$env:CHROME_DRIVER_PATH = "/path/to/chromedriver"
- In CMD (Windows)
set CHROME_DRIVER_PATH=/path/to/chromedriver
-
Run the
trainsearch.jar
file with java
# run with default values
java -jar trainsearch.jar
# or run with custom values
java -jar trainsearch.jar <fromCity> <toCity> <date> <class>
The first command will run the program with default values. The default values are:
fromCity
: LUCKNOWtoCity
: DELHIdate
: 2024-02-02 (yyyy-mm-dd)class
: 3A (3rd AC)
Supported values for:
class
-> 1A, 2A, 3A, 3E, SL, CC, 2S, ALLdate
-> yyyy-mm-dd
- Java 8
- Maven
- Chrome Browser
- Selenium
Testcase used in the below example:
- From City: "LUCKNOW"
- To City: "DELHI"
- Date of Journey: "02 Feb 2024"
- Class: "3A"
-
Checking if landed in the correct page by checking it's title text
-
Filling the form (from city, to city, date of journey and train class)
3.1 Select "from city input" and type in "LUCKNOW" and select the first option from the drop-down.
3.2 After selecting "from city" from the dropdown, input field for "to city" is automatically focused. Type in "DELHI" in "to city".
3.3 After selecting "to city" from dropdown, date input is automatically focused. We need to scroll to the input date month and select the date- 2 Feb 2024.
Travel Month was February so it scrolled one time and selected the input date.