how to click on the new button? application link is mention in my code

package CloudERP;
import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

//import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.interactions.Actions;

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.WebDriverWait;
public class InvoiceEntry {
public static void main(String[] args) throws Exception {

WebDriverWait wait;

WebDriver driver;

WebElement menu,submenu,frm;

driver =new FirefoxDriver();

driver.get("http://itwavelength.net/test/userlogin.aspx");

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

driver.findElement(By.xpath(".//*[@id='txtuser']")).sendKeys("accounts@001");

driver.findElement(By.xpath(".//*[@id='txtpassword']")).sendKeys("accounts@001");

driver.findElement(By.xpath(".//*[@id='btnlog']")).click();

System.out.println("message pass");

//WebElement frm= driver.findElement(By.xpath(".//*[@id='login_wrappers']/div[2]"));

//System.out.println("message pass111");
wait = new WebDriverWait(driver, 30);

wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(".//*[@id='BtnStart']")));
driver.findElement(By.xpath(".//*[@id='BtnStart']")).click();
// Click to AP Transactions

// driver.findElement(By.xpath(".//*[@id='jsddm']/li[5]/a"));// click to ap transaction

wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(".//*[@id='jsddm']/li[5]/a")));

System.out.println("AP Transactions");

menu=driver.findElement(By.xpath(".//*[@id='jsddm']/li[5]/a")); //AP Transactions
submenu=driver.findElement(By.xpath(".//*[@id='jsddm']/li[5]/ul/li[3]/a")); //Invoice Entry List
Actions builder =new Actions(driver);

builder.moveToElement(menu).build().perform(); //build added

Thread.sleep(2000);

builder.click(submenu).perform();

System.out.println("Invoice Entry List...");

//driver.switchTo().frame("frm");

//wait = new WebDriverWait(driver, 30);
//wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(".//*[@id='form1']/div[3]")));
driver.findElement(By.xpath(".//*[@id='form1']/div[3]"));// Click New Button

System.out.println("Invoice Entry List2222...");

//driver.findElement(By.xpath(".//*[@id='ctl00_UpdatePanel1']/div/div[1]/div/ul"));// Click New Button

//driver.findElement(By.xpath(".//*[@id='ctl00_ContentPlaceHolder1_btnClose2']")).click();

System.out.println("Invoice Entry List3333...");

//driver.switchTo().frame(0);

//driver.findElement(By.xpath(".//*[@id='ctl00_ContentPlaceHolder1_btnClose2']")).click();// Click New Button
wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnClose2']")));
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnClose2']")).click();

System.out.println("Invoice Entry List444...");

//*[@id="ctl00_UpdatePanel1"]/div/div[1]/div/ul
}
}

Default Asked on June 22, 2017 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.