diff --git a/ToolsQA_Project/.classpath b/Para_Bank/.classpath similarity index 100% rename from ToolsQA_Project/.classpath rename to Para_Bank/.classpath diff --git a/ToolsQA_Project/.project b/Para_Bank/.project similarity index 91% rename from ToolsQA_Project/.project rename to Para_Bank/.project index 7cf210a..7415687 100644 --- a/ToolsQA_Project/.project +++ b/Para_Bank/.project @@ -1,6 +1,6 @@ - ToolsQA_Project + Para_Bank diff --git a/ToolsQA_Project/.settings/org.eclipse.core.resources.prefs b/Para_Bank/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from ToolsQA_Project/.settings/org.eclipse.core.resources.prefs rename to Para_Bank/.settings/org.eclipse.core.resources.prefs diff --git a/ToolsQA_Project/.settings/org.eclipse.jdt.core.prefs b/Para_Bank/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from ToolsQA_Project/.settings/org.eclipse.jdt.core.prefs rename to Para_Bank/.settings/org.eclipse.jdt.core.prefs diff --git a/Para_Bank/bin/para_bank_project/Para_Bank.class b/Para_Bank/bin/para_bank_project/Para_Bank.class new file mode 100644 index 0000000..120ed8c Binary files /dev/null and b/Para_Bank/bin/para_bank_project/Para_Bank.class differ diff --git a/Para_Bank/src/para_bank_project/Para_Bank.java b/Para_Bank/src/para_bank_project/Para_Bank.java new file mode 100644 index 0000000..7a42709 --- /dev/null +++ b/Para_Bank/src/para_bank_project/Para_Bank.java @@ -0,0 +1,125 @@ +package para_bank_project; + +import java.time.Duration; + +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +public class Para_Bank { + + public static void main(String[] args) { + WebDriver driver = new ChromeDriver(); + driver.manage().window().maximize(); + + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); + driver.get("https://parabank.parasoft.com/parabank/index.htm"); + waitForTheUser(); + + WebElement registerButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[text()='Register']"))); + registerButton.click(); + waitForTheUser(); + + JavascriptExecutor scrollDown = (JavascriptExecutor) driver; + scrollDown.executeScript("window.scrollBy(0,200)"); + waitForTheUser(); + + WebElement firstName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.firstName']"))); + firstName.click(); + firstName.sendKeys("Ethan"); + waitForTheUser(); + + WebElement lastName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.lastName']"))); + lastName.click(); + lastName.sendKeys("Winters"); + waitForTheUser(); + + WebElement addressField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.address.street']"))); + addressField.click(); + addressField.sendKeys("Old Dulvey Plantation, 136 Bayou Road"); + waitForTheUser(); + + WebElement cityField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.address.city']"))); + cityField.click(); + cityField.sendKeys("Dulvey"); + waitForTheUser(); + + WebElement stateField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.address.state']"))); + stateField.click(); + stateField.sendKeys("Louisiana"); + waitForTheUser(); + + WebElement zipCode = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.address.zipCode']"))); + zipCode.click(); + zipCode.sendKeys("70544"); + waitForTheUser(); + + WebElement phoneNumber = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.phoneNumber']"))); + phoneNumber.click(); + phoneNumber.sendKeys("(337) 555-0199"); + waitForTheUser(); + + WebElement ssnField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.ssn']"))); + ssnField.click(); + ssnField.sendKeys("441-75-8901"); + waitForTheUser(); + + WebElement userName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.username']"))); + userName.click(); + userName.sendKeys("ethan@1984"); + waitForTheUser(); + + WebElement passWord = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='customer.password']"))); + passWord.click(); + passWord.sendKeys("EthanwinterS@1984!"); + waitForTheUser(); + + WebElement repeatedPassword = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='repeatedPassword']"))); + repeatedPassword.click(); + repeatedPassword.sendKeys("EthanwinterS@1984!"); + waitForTheUser(); + + WebElement submitButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//input[@type='submit'])[2]"))); + submitButton.click(); + waitForTheUser(); + + WebElement loginMessage = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h1[@class='title']"))); + System.out.println("Login Message: " + loginMessage.getText()); + System.out.println("Your account was created successfully. You are now logged in."); + waitForTheUser(); + + WebElement logOut = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[text()='Log Out']"))); + logOut.click(); + System.out.println(); + System.out.println("Successfully logged out."); + waitForTheUser(); + + WebElement usernameField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='username']"))); + usernameField.click(); + usernameField.sendKeys("ethan@1984"); + waitForTheUser(); + + WebElement passwordField = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='password']"))); + passwordField.click(); + passwordField.sendKeys("EthanwinterS@1984!"); + waitForTheUser(); + + WebElement loginButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Log In']"))); + loginButton.click(); + waitForTheUser(); + + driver.close(); + } + + public static void waitForTheUser() { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff --git a/README.md b/README.md index 8781783..a9089b7 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ -# Registration-Form-Automation \ No newline at end of file +# Para Bank Project + +## Description +The ParaBank project is an automation script for testing the functionalities of the ParaBank online banking application using Selenium WebDriver. The script performs actions such as account registration, login, and logout by interacting with the web elements on the application. + +## Features +- **User Registration**: Automates the process of filling out and submitting a user registration form with details like name, address, phone number, and more. +- **Login**: Automates the login process using the credentials created during registration. +- **Logout**: Automates the logout action after logging in successfully. +- **Page Interactions**: Handles actions like filling out form fields, clicking buttons, and scrolling through pages. +- **Synchronization**: Implements explicit waits to ensure that the script interacts with elements only when they are available for interaction. + +## Prerequisites +Before running the script, ensure that the following are installed on your system: +- **Java**: JDK 8 or higher +- **Eclipse IDE** (or any other IDE that supports Java) +- **Selenium WebDriver**: The Selenium WebDriver Java library is needed to interact with the browser. +- **ChromeDriver**: The ChromeDriver executable is required for Chrome browser automation. + +## Technologies Used +- **Java**: The core programming language for writing the test script. +- **Selenium WebDriver**: A tool for automating web browser interaction. +- **JUnit** (optional, not included in the provided code but can be used for structuring tests). +- **ChromeDriver**: A standalone server that implements WebDriver's wire protocol for Chromium-based browsers like Google Chrome. diff --git a/ToolsQA_Project/bin/tools_qa_page/Registeration_Form.class b/ToolsQA_Project/bin/tools_qa_page/Registeration_Form.class deleted file mode 100644 index e93963c..0000000 Binary files a/ToolsQA_Project/bin/tools_qa_page/Registeration_Form.class and /dev/null differ diff --git a/ToolsQA_Project/src/tools_qa_page/Registeration_Form.java b/ToolsQA_Project/src/tools_qa_page/Registeration_Form.java deleted file mode 100644 index 15766f2..0000000 --- a/ToolsQA_Project/src/tools_qa_page/Registeration_Form.java +++ /dev/null @@ -1,99 +0,0 @@ -package tools_qa_page; - -import java.time.Duration; -import java.util.Scanner; - -import org.openqa.selenium.Alert; -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - -public class Registeration_Form { - - public static void main(String[] args) { - WebDriver driver = new ChromeDriver(); - driver.manage().window().maximize(); - - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); - driver.get("https://demoqa.com/login"); - - WebElement newUser = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@id='newUser']"))); - newUser.click(); - waitForTheUser(); - - JavascriptExecutor scrollDownTwo = (JavascriptExecutor) driver; - scrollDownTwo.executeScript("window.scrollBy(0,200)"); - waitForTheUser(); - - WebElement firstName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='firstname']"))); - firstName.click(); - firstName.sendKeys("Mia"); - waitForTheUser(); - - WebElement lastName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='lastname']"))); - lastName.click(); - lastName.sendKeys("Winters"); - waitForTheUser(); - - WebElement userName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='userName']"))); - userName.click(); - userName.sendKeys("mia@22"); - waitForTheUser(); - - WebElement passWord = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='password']"))); - passWord.click(); - passWord.sendKeys("MiaWinters@22!"); - waitForTheUser(); - - // Pause the script for manual CAPTCHA solving - System.out.println("Please solve the CAPTCHA manually and press Enter to continue..."); - Scanner scanner = new Scanner(System.in); - scanner.nextLine(); // Waits for user input - scanner.close(); // Close the Scanner to avoid resource leak - - WebElement registerButon = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@id='register']"))); - registerButon.click(); - waitForTheUser(); - - Alert simpleAlert = driver.switchTo().alert(); - simpleAlert.accept(); - System.out.println("Alert accepted successfully."); - waitForTheUser(); - - WebElement backButon = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//button[@type='button'])[3]"))); - backButon.click(); - waitForTheUser(); - - WebElement uName = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='userName']"))); - uName.click(); - uName.sendKeys("mia@22"); - waitForTheUser(); - - WebElement pWord = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='password']"))); - pWord.click(); - pWord.sendKeys("MiaWinters@22!"); - waitForTheUser(); - - WebElement loginButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@id='login']"))); - loginButton.click(); - waitForTheUser(); - - WebElement logoutButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//button[@type='button'])[2]"))); - logoutButton.click(); - waitForTheUser(); - - driver.close(); - } - - public static void waitForTheUser() { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -}