Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.example;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import org.openqa.selenium.support.ui.WebDriverWait;
- import org.openqa.selenium.support.ui.ExpectedConditions;
- import java.time.Duration;
- public class createDeposit {
- WebDriver driver;
- public void launchBrowser() {
- System.setProperty("webdriver.chrome.driver", "/Users/alaricsecurities/Downloads/chromedriver-mac-x64 4/chromedriver");
- driver = new ChromeDriver();
- try {
- driver.get("https://myportal-dev.alaric.bg/");
- WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
- WebElement usernameField = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Username")));
- WebElement passwordField = driver.findElement(By.id("Password"));
- passwordField.sendKeys("Test@123!");
- WebElement loginButton = driver.findElement(By.name("button"));
- loginButton.click();
- WebElement cookies = wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("cky-btn-accept")));
- cookies.click();
- WebElement menuTransfersButtons = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[normalize-space(text())='Трансфери']")));
- menuTransfersButtons.click();
- WebElement buttonZahranvane = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[normalize-space(text())='Захранване']")));
- buttonZahranvane.click();
- WebElement inputValue = wait.until(ExpectedConditions.elementToBeClickable(By.id("mat-input-0")));
- inputValue.sendKeys("5000");
- WebElement buttonZahraniSmetka = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[contains(.,'Захрани сметка')]")));
- buttonZahraniSmetka.click();
- String expectedIban = "BG84UNCR70002283869475";
- String pageSource = driver.getPageSource();
- if (pageSource.contains(expectedIban)) {
- System.out.println("The IBAN exists in the page source.");
- } else {
- System.out.println("The IBAN does NOT exist in the page source.");
- }
- WebElement ibanElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(text(), '" + expectedIban + "')]")));
- String actualIban = ibanElement.getText().trim();
- System.out.println("Actual IBAN from page: '" + actualIban + "'");
- if (actualIban.equals(expectedIban)) {
- System.out.println("IBAN is correct: " + actualIban);
- } else {
- System.out.println("IBAN mismatch! Expected: " + expectedIban + ", but found: " + actualIban);
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- driver.quit();
- }
- }
- public static void main(String[] args) {
- createDeposit obj=new createDeposit();
- obj.launchBrowser();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement