Interview Program

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

package practice;

import java.time.Duration;

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.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

import io.github.bonigarcia.wdm.WebDriverManager;

public class Demo1 {

@Test
public void getTitle() throws InterruptedException
{
WebDriverManager.chromedriver().setup();

ChromeOptions options = new ChromeOptions();

options.addArguments("--remote-allow-origins=*");

WebDriver driver = new ChromeDriver(options);

driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));

driver.get("https://returns-cpa.safesendreturns.com/");

driver.manage().window().maximize();

//Thread.sleep(2000);

WebElement email =
driver.findElement(By.id("txtUsername"));

email.sendKeys("test170423@yopmail.com");

WebElement password =
driver.findElement(By.id("txtPassword"));
password.sendKeys("Test@1234");

WebElement loginButton =
driver.findElement(By.id("btnLogin"));

loginButton.click();

String actualTitle= driver.getTitle();

System.out.println("Title of the page is: "+actualTitle);

String expectedTitle="SafeSend Returns";

Assert.assertEquals(actualTitle, expectedTitle,"Title is
not matching");

driver.quit();

You might also like