package practice;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
public class actitimepractical {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
String Expmsg="Customer has been successfully registered";
//navigate to actitime
FirefoxDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://localhost/login.do");
//login to actitime
driver.findElement(By.name("username")).sendKeys("admin");
driver.findElement(By.name("pwd")).sendKeys("manager");
driver.findElement(By.xpath("//input[@type='submit']")).click();
driver.findElement(By.xpath("//a[text()='Projects & Customers']")).click();
Thread.sleep(25000);
driver.findElement(By.xpath("//input[@value='Add New Customer']")).click();
Thread.sleep(4000);
driver.findElement(By.name("name")).sendKeys("abc165");
driver.findElement(By.name("createCustomerSubmit")).click();
String actmsg=driver.findElement(By.xpath("//span[contains(text(),'Customer has been successfully registered')]")).getText();
if(actmsg.contains(Expmsg))
{
System.out.println("pass");
}
else
{
System.out.println("fail");
}
driver.findElement(By.xpath("//img[@class='logoutImg']")).click();
}
}
Points:
1.First we have to install acti time application
2.we have to install the eclipse and that add selinium web driver jars files.
3.create a new project
4.create new class
ACTI TIME APPLICATION:
1.Navigate to actitime.
2.login to acti time
3.click on project and customer link
4.click on create new customer button and create customer
5.logout
Note:
we have to change your own customer names
driver.findElement(By.name("name")).sendKeys("abc");.....(example)







What is the use of contain function? In this whenever, however, wherever?
ReplyDeletewriting Dyanamic xpath for locating element.
ReplyDeleteBy using 'contains' function in XPath, we can extract all the elements which matches a particular text value.