I'm looking to streamline the process of inputting a value into a text box on a webpage, similar to automating my timesheet. The HTML code for the text box is shown below.
<input type="text" class="" onblur="return setValue(this);" title="Time"; onfocus="return getValue(this)" onkeydown="return Validate(event);" value="" id="0_0_1">
The value '9.00' needs to be entered into this textbox. I've attempted using the following code:
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById('0_0_1').value = '9.00';");
I've also tried the following:
driver.findElement(By.xpath("//*[@id="0_0_1"]")).sendKeys("9.00");
and even
driver.findElement(By.id("0_0_1")).sendKeys("9.00");
Unfortunately, the time value is not being filled in the textbox. Could it be because of the onblur, onfocus, and onkeydown attributes in the code? Any suggestions would be greatly appreciated. Thank you in advance.