Trying to send/set text using webdriver sendkeys() function for text field
Here is the HTML
<table class="gridtable" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" gwtcellbasedwidgetimpldispatchingblur="true" style="width: 100%;">
<thead>
<colgroup>
<tbody style="">
<tr class="GORM0XEDKD GORM0XEDME" onclick="">
<td class="GORM0XEDJD GORM0XEDLD GORM0XEDMD GORM0XEDNE">
<td class="GORM0XEDJD GORM0XEDLD GORM0XEDNE GORM0XEDGE">
<div style="outline:none;" tabindex="0"></div>
</td>
</tr>
</tbody>
<tbody style="display: none;">
<tfoot style="display: none;">
</table>
Xpath for the text field -
EmailTemplateEditorTemplateName= By.xpath("//*[contains(@class,'GORM0XEDJD GORM0XEDLD GORM0XEDNE GORM0XEDGE')]/div[1]");
Tried following options. But all are failing to send text to EmailTemplateEditorTemplateName text field
1. driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName).sendKeys("yahooo"); 2. this.WaitForElement(DesignerLocators.EmailTemplateEditorTemplateName); WebElement tempname = driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName); JavascriptExecutor rightexecutor = (JavascriptExecutor)driver; rightexecutor.executeScript("arguments[0].setAttribute('value','yahoo')", tempname); 3. WebElement Element=driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName); Actions builder = new Actions(driver); builder.moveToElement(Element).sendKeys("yahoo").build().perform(); 4. WebElement Element=driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName); Actions builder = new Actions(driver); builder.moveToElement(Element).click().sendKeys("yahoo").build().perform(); 5. WebElement Element=driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName); Actions builder = new Actions(driver); builder.moveToElement(Element).click(Element).sendKeys("yahoo").build().perform();click() is working.
- Interestingly getText() is working for the same text field using same xpath. String val=driver.findElement(DesignerLocators.EmailTemplateEditorTemplateName).getText();
- Only sendKeys() is not working. And not throwing any error.
- Please help me to set/send text in my text field.