Search This Blog

Saturday, March 29, 2014

How to send text to webelement using javascript


Sometimes with webdriver its not possible to type text in a textbox like password,extjs textbox fields. At that time try below script to send text to textbox. It works.

WebDriver driver = new FirefoxDriver();

((JavascriptExecutor)driver).executeScript("arguments[0].value='test'", driver.findElement(By.xpath(xpath)));