0% found this document useful (0 votes)
31 views3 pages

Methods

hh

Uploaded by

surabhisharmamca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Methods

hh

Uploaded by

surabhisharmamca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.By.ById;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import io.github.bonigarcia.wdm.WebDriverManager;

public class methods {


static ChromeDriver driver ;
@BeforeTest()
public void setup()
{

WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();

driver.get("http://automationpractice.com/index.php");
}
@Test(priority = 1 )
public void test1() {
driver.findElement(By.xpath("//*[@id=\"contact-link\"]/a")).click();

driver.findElement(By.xpath("//*[@id=\"submitMessage\"]/span")).click();
System.out.println("failed");
String testdisplayed =
driver.findElement(By.xpath("//*[@id=\"center_column\"]/div/p")).getText();

System.out.println(testdisplayed);

@Test(priority = 2)
public void test2() {
WebElement wmousehover =
driver.findElement(By.xpath("//*[@id=\"block_top_menu\"]/ul/li[1]/a"));
Actions action = new Actions(driver);
action.moveToElement(wmousehover).perform();

//contact us
WebElement contactus1 =
driver.findElement(By.xpath("//*[@id=\"contact-link\"]/a"));
contactus1.click();
WebElement dropdown1 =
driver.findElement(By.xpath("//*[@id=\"id_contact\"]"));
Select select1 = new Select(dropdown1);
select1.selectByIndex(1);
WebElement email1 =
driver.findElement(By.xpath("//*[@id=\"email\"]"));
email1.sendKeys("[email protected]");

WebElement orderno1 =
driver.findElement(By.xpath("//*[@id=\"id_order\"]"));

orderno1.sendKeys("12522");

//
driver.findElement(By.xpath("//*[@id=\"fileUpload\"]")).sendKeys("C:\\Users\\
91963\\Desktop");

WebElement textarea1 =
driver.findElement(By.xpath("//*[@id=\"message\"]"));
textarea1.sendKeys("i am disstatisfied with your product ");

WebElement submit1 =
driver.findElement(By.xpath("//*[@id=\"submitMessage\"]/span"));
submit1.click();
String print1 =
driver.findElement(By.xpath("//*[@id=\"center_column\"]/p")).getText();
System.out.println(print1);

@Test(priority = 3)
@Parameters({"email_create"})
public void home(@Optional String email_create) {

driver.findElement(By.xpath("//*[@id=\"center_column\"]/ul/li/a/span")).click();
driver.findElement(By.xpath("//*[@id=\"header\"]/div[2]/div/div/nav/
div[1]/a")).click();

driver.findElement(By.xpath("//*[@id=\"email_create\"]")).sendKeys(email_create);
driver.findElement(By.xpath("//*[@id=\"SubmitCreate\"]/span")).click();

@Test(priority = 4)
public void regstration()
{
driver.findElement(By.id("submitAccount")).click();
}
//
//@AfterTest()

//public void closeup() {


//driver.quit();}
}

You might also like