Identify elements not in repository
Posted: Thu Oct 19, 2017 8:12 pm
Longtime UFT developer and new to Ranorex.
I've recorded of a small script that will add a segment, click a link and fill out some drop downs on a web page. In the repository are the objects captured from that recording. However, I intend the script to be much larger as I will add segments and click similar links, etc...essentially repeating the pre-recorded script but clicking on links and boxes that are created on the fly at different points on the page. These newer objects differ slightly by their ID.
I would rather not record the entire script and add all objects to the repository one by one. Instead I would like to perform all new object identification and interaction dynamically via C# code. I know what the names of the IDs are going to be. However, I'm having trouble identifying these controls because I'm unable to construct the appropriate code to accomplish this. I've searched the forums and Google extensively and cannot seem to capture the correct syntax for this task.
Attached is the snapshot of the dom. The controls in question have the ID of:
ctl00_phMain_lvSegments_ctrl0_fieldUI_lvField_ctrl0_btnEdit <-- this is the only one in the repository, the following will be new:
ctl00_phMain_lvSegments_ctrl1_fieldUI_lvField_ctrl0_btnEdit
ctl00_phMain_lvSegments_ctrl2_fieldUI_lvField_ctrl0_btnEdit
I'm familiar with GetElementById() and am looking for similar functions or snippets to identify elements.
Thanks.
Ranorex 6.1.0
Win7 SP1
I've recorded of a small script that will add a segment, click a link and fill out some drop downs on a web page. In the repository are the objects captured from that recording. However, I intend the script to be much larger as I will add segments and click similar links, etc...essentially repeating the pre-recorded script but clicking on links and boxes that are created on the fly at different points on the page. These newer objects differ slightly by their ID.
I would rather not record the entire script and add all objects to the repository one by one. Instead I would like to perform all new object identification and interaction dynamically via C# code. I know what the names of the IDs are going to be. However, I'm having trouble identifying these controls because I'm unable to construct the appropriate code to accomplish this. I've searched the forums and Google extensively and cannot seem to capture the correct syntax for this task.
Attached is the snapshot of the dom. The controls in question have the ID of:
ctl00_phMain_lvSegments_ctrl0_fieldUI_lvField_ctrl0_btnEdit <-- this is the only one in the repository, the following will be new:
ctl00_phMain_lvSegments_ctrl1_fieldUI_lvField_ctrl0_btnEdit
ctl00_phMain_lvSegments_ctrl2_fieldUI_lvField_ctrl0_btnEdit
I'm familiar with GetElementById() and am looking for similar functions or snippets to identify elements.
Thanks.
Ranorex 6.1.0
Win7 SP1