How do you parameterize object locators in TestComplete
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you parameterize object locators in TestComplete
I am using data driven test methods. Some of the links in our web app are titles of works and include the title string in the link locator, How can I parameterize the locator to use the data string supplied in the excel file for the data loop?
Solved! Go to Solution.
- Labels:
-
Data-Driven Testing
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"beginningoflinkgoeshere"+Eval(referencetoexcelgoeshere)+"endoflinkgoeshere"
then use that variable where you need the link
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add the Find Object operation to your keyword test. Specify the object TestComplete will search for and click Next..Specify the list of object properties to check and the property values for the sought-for object: ..Choose the found object's method to call and click Finish.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both of your replies have been helpful but not the complete answer.
In the "Edit Name Mapping Item" window, I want to create a selector that will pull a string value from a data source as shown in the attached screenshot.
The highlighted selector works the best but only when the text value matches.
Any suggestions would be helpful.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, now that we have the complete question, perhaps we can get you a complete answer!
You can tell the name mapping to use a project variable. Build the variable as I described before and assign that variable in this dialog.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, This works.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, After getting this working I wanted to post What I actually did.
I was not able to create the project string variable the way that Marsha_R described.
""beginningoflinkgoeshere"+Eval(referencetoexcelgoeshere)+"endoflinkgoeshere""
I consistently got an error whenever I used the Eval function in the "Set Variable Value" dialog.
Inside of a script this may work just fine.
I also could not concatenate the value from my table data with any other string in the "Set Variable Value" function.
To get this to work I created a variable with just the table data in it.
After that I was able to create the variable with the string that I needed.
'//a[.="'+Project.Variables.SearchResultsTitleString+'"]'
To set the locator property, I used the following. %SearchResultsTitleLocator%
NOTE: you do not use the "Project.Variables." prefix when referencing the variable here. It is expecting this to be a project variable. Adding the prefix will cause a runtime error. Also, you have to enclose the variable name with "%".
Now when I run my test, I can select the list element by the title name and get the specific Item that I am looking for.
Winner Winner Chicken Dinner !!!
The following documents were very helpful.
