My testing team is using selenium to automate salesforce testing,in the process, they reference the Id's of text boxe's or drop down boxes in the automation script,this works well and good for standard fields as they are similar across different organizations but for custom fields this varies and hence they have to develop different script for each instance, any help on resolving this issue would help us .thanks

  • 1
    Why are they using field id as selector? They should use field label as selector in their xpath.
    – javanoob
    Jan 6, 2017 at 20:07
  • My first reaction when using Selenium was the same as yours as using the ID values is a natural thing to want to do. But there is no API to get the custom field IDs and so you are forced to use an alternate pattern such as the one that javanoob suggests.
    – Keith C
    Jan 7, 2017 at 10:54

2 Answers 2


I was facing the same problem. As it was suggested in the comments above using another attribute than id actually works. So try any other unique field in the selector:




Try to create your own XPath. eg: xpath : //*[@tagName= "Testing"]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .