mardi 3 janvier 2017

Testng with Two methods in same class

package com.hrms.LIB;

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test;``

public class WebDriver1 {

@Test(priority=1)
public void Orange() throws Exception {
WebDriver d1=new FirefoxDriver();
d1.manage().window().maximize();
d1.navigate().to("http://ift.tt/2i5n6mB");
d1.findElement(By.name("txtUserName")).sendKeys("selenium");
d1.findElement(By.name("txtPassword")).sendKeys("selenium");
d1.findElement(By.xpath("//input[@name='Submit']")).click();
System.out.println("Login Completed");
}

@Test(priority=2)
public void orange2(){
Orange d2=new Orange();

d2.switchTo().frame("rightMenu");
d2.findElement(By.xpath("/html/body/div/div[2]/form/table/thead/tr/td[1]/input")).click();
d2.findElement(By.xpath("//input[@class='plainbtn'][@value='Delete']")).click();
d2.switchTo().defaultContent();
System.out.println("Records Delted Successfully");

d2.findElement(By.linkText("Logout")).click();
d2.quit();
}

}

Aucun commentaire:

Enregistrer un commentaire