Want to replace/overwrite zero in a text box by a value from excel

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Want to replace/overwrite zero in a text box by a value from excel

yaaron.dosti
My application generates a zero in a textbox automatically. I want to replace/overwrite the zero by a value from my excel by sendkeys. I have already used replace, Control+a, double click even clear. But unfortunately did not work. Any help will be appreciated.

/To store Auto generated value of TDV

    String autogeneratedTDV=driver.findElement(By.id("createShipmentForm2:totalDeclaredValue")).getAttribute("value");
    excel.printoutput(0, row, 2, autogeneratedTDV);

    Thread.sleep(5000);

    //To change the value of Total Declared value field

    String TDV=excel.getNumericData(1, row, 31);

    if (TDV!="")
    {
    driver.findElement(By.id("createShipmentForm2:totalDeclaredValue")).sendKeys(Keys.HOME,Keys.chord(Keys.SHIFT,Keys.END),TDV);
    }
    else
    {

    Thread.sleep(5000);
    //driver.findElement(By.id("createShipmentForm2:totalDeclaredValue")).clear();

    Actions builder = new Actions(driver);
    builder.doubleClick(driver.findElement(By.id("createShipmentForm2:totalDeclaredValue"))).perform();

    //String selectAll=Keys.chord(Keys.CONTROL,"a");
    //driver.findElement(By.id("createShipmentForm2:totalDeclaredValue")).sendKeys(selectAll);
    Thread.sleep(8000);
    driver.findElement(By.id("createShipmentForm2:totalDeclaredValue")).sendKeys(excel.getNumericData(0, row, 2));

    }

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9769a5dc-ccfc-4892-865b-a5a7028c07c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.