Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 361 Vote(s) - 3.6 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Values are not displaying in UserInterface using Web Driver

#1
I am new in Selenium webdriver.When i reading values from Excel sheet and saved to database.The values are not displaying in the webpage and also not inserted to Database.
Here this is my code for one form.If there any way for solving this issue.


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.chrome.ChromeDriver;
public class DeliveryNote
{


public static void main(String[] args) throws InterruptedException, BiffException, IOException
{


//For ChromeBrowser
//System.setProperty("webdriver.chrome.driver", "E:/Softwares/Chrome/Chromedriver.exe");
//WebDriver driver = new ChromeDriver();

WebDriver driver = new FirefoxDriver();

//Puts a Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

//Launch website
driver.navigate().to("http://192.168.1.185:8080/Nayonika/loginPage.html");
//Maximize the browser
driver.manage().window().maximize();


// xpath of username
driver.findElement(By.xpath("/html/body/div[1]/div/div[1]/p[1]/input")).sendKeys("aaa");

// xpath of password
driver.findElement(By.xpath("/html/body/div[1]/div/div[1]/p[2]/input")).sendKeys("2222");

//xpath of checkbox
driver.findElement(By.xpath("/html/body/div[1]/div/div[1]/p[3]/label/input")).click();

//xpath of login button
driver.findElement(By.xpath("/html/body/div[1]/div/div[1]/p[4]/input")).click();

System.out.println(" Login Successfully.....");


//Puts a Implicit wait, Will wait for 20 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//Navigate to sales
Actions actions = new Actions(driver);
//Xpath of Documents
WebElement Mainmenu = driver.findElement(By.xpath("/html/body/div[2]/div/div[1]/ul/ul/li[1]/a"));
//xpath of Sales
WebElement Submenu = driver.findElement(By.xpath("/html/body/div[2]/div/div[1]/ul/ul/li[1]/ul/li[2]/a"));
//xpath of Delivery Note
WebElement Childsubmenu = driver.findElement(By.xpath("/html/body/div[2]/div/div[1]/ul/ul/li[1]/ul/li[2]/ul/li[5]/a"));
actions.moveToElement(Mainmenu).moveToElement(Submenu).moveToElement(Childsubmenu).click().build().perform();
Thread.sleep(5000);

//Specify the file path of the excelsheet
FileInputStream fi = new FileInputStream("D:\\7SYSERP\\deliverynote.xls");
Workbook W = Workbook.getWorkbook(fi);
//TO get the access to the sheet
Sheet s = W.getSheet(0);



// xpath of New Button
driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[2]/tr[2]/td/input[1]")).click();

for(int i = 4; i<= 5;i++)
{


// xpath of New Button
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[2]/tr[2]/td/input[1 ")).click();
//Puts a Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//xpath of StockDetail id
String stkdtlid = s.getCell(0,i).getContents();
System.out.println("StockDetail id" + stkdtlid);
// driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[1]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[1]/input")).sendKeys(stkdtlid);
//driver.findElement(By.id("1196")).clear();
driver.findElement(By.id("1196")).sendKeys(stkdtlid);
System.out.println("StockDetail id1" + stkdtlid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//xpath of Delivery Note Detail Remarks
String remarks = s.getCell(1,i).getContents();
System.out.println("Delivery Note Detail Remarks" +remarks);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[2]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[2]/input")).sendKeys(remarks);
//driver.findElement(By.id("287")).clear();
driver.findElement(By.id("287")).sendKeys(remarks);
System.out.println("Delivery Note Detail Remarks 1" +remarks);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

// xpath of Delivery Note Details Status id
String delntdtlstatusid = s.getCell(2,i).getContents();
System.out.println("Delivery Note Details Status id" +delntdtlstatusid);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[3]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[3]/input")).sendKeys(delntdtlstatusid);
//driver.findElement(By.id("286")).clear();
driver.findElement(By.id("286")).sendKeys(delntdtlstatusid);
System.out.println("Delivery Note Details Status id 1" +delntdtlstatusid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//xpath of Quantity
String qty = s.getCell(3,i).getContents();
System.out.println("Quantity " +qty );
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[4]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[4]/input")).sendKeys(qty );
//driver.findElement(By.id("285")).clear();
driver.findElement(By.id("285")).sendKeys(qty);
System.out.println("Quantity 1" +qty );
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//xpath of Unit id
String untitid = s.getCell(4,i).getContents();
System.out.println("Unit id" +untitid);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[5]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[5]/input")).sendKeys(untitid);
//driver.findElement(By.id("284")).clear();
driver.findElement(By.id("284")).sendKeys(untitid);
System.out.println("Unit id 1" +untitid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

//xpath of Item id
String itemid = s.getCell(5,i).getContents();
System.out.println("Item id " + itemid);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[6]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[6]/input")).sendKeys(itemid);
//driver.findElement(By.id("283")).clear();
driver.findElement(By.id("283")).sendKeys(itemid);
System.out.println("Item id 1 " + itemid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

// xpath of Delivery Note id
String delvrynteid = s.getCell(6,i).getContents();
System.out.println("Delivery Note id" +delvrynteid);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[7]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[7]/input")).sendKeys(delvrynteid);
//driver.findElement(By.id("282")).clear();
driver.findElement(By.id("282")).sendKeys(delvrynteid);
System.out.println("Delivery Note id 1" +delvrynteid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

// xpath of Delivery Note Detail id
String delvryntedtlid = s.getCell(7,i).getContents();
System.out.println("Delivery Note Detail id " +delvryntedtlid);
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[8]/input")).clear();
//driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[8]/input")).sendKeys(delvryntedtlid);
//driver.findElement(By.id("281")).clear();
driver.findElement(By.id("281")).sendKeys(delvryntedtlid);
System.out.println("Delivery Note Detail id 1 " +delvryntedtlid);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);


// xpath of Save
driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div/table[1]/tr[2]/td[9]/input[1]")).click();
System.out.println("Saved");
}


driver.close();

}

}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through