Like us on Facebook

LightBlog

November 30, 2014

Perform Type Action using Java script in Text field

November 30, 2014 2
Perform Type Action using Java script in Text field
To type in a text field/text box  we use sendKeys command. But some times sendKeys will not work some of the text fields. In those situations one of the alternative is using JavaScript. We can use Java script to type in text field.

In below example I used JavaScript to type in text field.
Below is syntax: 
((JavascriptExecutor) driver).executeScript("arguments[0].value = 'some text';",driver.findElement(By.XPath('your xpath')))