nameMapping- How to pass project variable in the namemapping xpath
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nameMapping- How to pass project variable in the namemapping xpath
Hello,
I thought I saw somewhere but can't find the answer for this again. I am trying to pass variable that's defined in the project Temp variables section and combine with a text.
for ex: Xpath = //div[.='abcd']
I want something like
Xpath = //div[.=Project.variables.myText]
Same for url
URL = http://Project.variables.MyURL/webpage.html
This URL will be different from Lower environment to Prod. So I can't just user * in the url part.
Thanks
- Labels:
-
Name Mapping
-
Variables
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is what I would try:
let Test = frame.FindElement("//div[.='" + Project.Variables.Name + "']");
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. I am looking to pass variable in to nameMapping repository. I know how to do with in the script. But my project is in Keyword test and I need to pass URL for page and some test data for objects.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry I haven't tried keyword based testing But I think you can try only adding:
div[.='" + Project.Variables.Name + "']" to the keyword
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, If I confused you. I want that variable to be used in the nameMapping window as shown in below. I saw in one of the post sometime back that only project variables can be used in the nameMapping objects. but can't find that exact syntax. The below syntax is not working for me.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found this page with an example, but still TC is not able to find the page object
Project.Variables.MyURL = "https://ea-webapp-dev-raven.com/"
URL= %Project.Variables.MyURL%email-batches/*
Not sure whats wrong I am doing here. Can someone please help me
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if this will help.
https://www.youtube.com/watch?v=huWhD_gN0Nc
or this link
https://community.smartbear.com/t5/TestComplete-Questions/Insert-variables-in-a-dynamic-URL/m-p/1306...
Sorry that I'm not a better help.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's an example using Code Expression,
Project.Variables.MyVariable is set to "https://community.smartbear.com", and I want to add "/t5/TestComplete/ct-p/TestComplete_forum". The URL will then come "https://community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum"
