When trying to send text to a TextBox created via PrimeFaces:
I try:
getDriver().findElement(By.id("addRowTable:0:hostName")).sendKeys("testing");
Html is:
<HTML>
<label>Enter Hostname:</label><script id="addRowTable:0:j_idt474_s" type="text/javascript">$(function() {PrimeFaces.cw('Watermark','widget_addRowTable_0_j_idt474',{id:'addRowTable:0:j_idt474',value:'Hostname',target:'addRowTable:0:hostName'},'watermark');});</script>
<span class="zoneName"><input id="addRowTable:0:hostName" name="addRowTable:0:hostName" type="text" maxlength="254" size="20" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /><script id="addRowTable:0:hostName_s" type="text/javascript">PrimeFaces.cw('InputText','widget_addRowTable_0_hostName',{id:'addRowTable:0:hostName'});</script>.xxxxcxxxxxdddddddddd.net</span></td>
</HTML>
I get the XPath as:
//*[@id="addRowTable:0:hostName"]
I get exception:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"addRowTable\\:0\\:hostName"}
Command duration or timeout: 149 milliseconds
For documentation on this error, please visit:
http://seleniumhq.org/exceptions/no_such_element.html
When i look at
http://seleniumhq.org/exceptions/no_such_element.html
i get a generic explanation:
The element may not be present.
Even Escaping : with \\ did not work
getDriver().findElement(By.id("addRowTable\\:0\\:hostName")).sendKeys("testing");