First of all you
have to change the value of type attribute as text from hidden. The following
code using javascript would work for that:
EX:
jse.executeScript("document.getElementsByName('body')[0].setAttribute('type',
'text');");
Now, you are
able to type on that text by using WebDriver. So, the overall code for typing
with WebDriver using Java and Javascript as follows:
EX:
JavascriptExecutor
jse = (JavascriptExecutor)driver;
jse.executeScript("document.getElementsByName('body')[0].setAttribute('type',
'text');");
driver.findElement(By.xpath("//input[@name='body']")).clear();
driver.findElement(By.xpath("//input[@name='body']")).sendKeys("Ripon:
body text");
No comments:
Post a Comment