Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I use Webdriver (Selenium2) locator to locate PrimeFaces autogenerated ID's with Colon

Kamal Ahmed
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When trying to send text to a TextBox created via PrimeFaces:

I try:


Html is:

<label>Enter Hostname:</label><script id="addRowTable:0:j_idt474_s" type="text/javascript">$(function() {'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">'InputText','widget_addRowTable_0_hostName',{id:'addRowTable:0:hostName'});</script></span></td>


I get the XPath as:


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:

When i look at

i get a generic explanation:

The element may not be present.

Even Escaping : with \\ did not work

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic