function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CaitlinMCaitlinM 

Selenium automated testing -- locating Visualforce elements

I've succesfully used the Selenium IDE to record and play back tests in my browser within Salesforce. 

 

Where I'm hitting an issue is with the portion of my testing that involves a Visualforce wizard. Since the element IDs are dynamic, if I close the browser and start a new session, my test can't find the elements. 

 

I'm looking for a way to identify these dynamic elements in the Selenium IDE. I've read through some documentation but haven't found something that seems to work with Visualforce. Any ideas? Here's an example of an element I'm trying to find, to input text:

 

<apex:inputField id="s1f04" required="true" style="width: 200px" value="{!newSession.Class__c}"/>   

 

Here's an example of the dynamic IDs that are generated, which change every time: id=j_id0:scwform:j_id29:j_id65:s1f05

 

Is there some way I can use this "s1f04" id to locate my field? Something else?