Reference to an HTML object having a string with his mapped name
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reference to an HTML object having a string with his mapped name
Hi to all, I have the mapped name of an HTML object in a string and I want find its reference with a method like this:
var elementReference = Aliases.browser.page.form.byName(mappedName);
Thanks to all
Solved! Go to Solution.
- Labels:
-
Name Mapping
-
Script Tests
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See Find Mapped Objects by Aliases, WaitAliasChild Method
Can you not use?
var elementReference = Aliases.browser.page.form.mappedName;
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Assuming that you have:
var aStr = "Aliases.browser.page.form.mappedName";
Are you looking for this:
var anObj = eval(aStr);
?
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AlexKaras wrote:Hi,
Assuming that you have:
var aStr = "Aliases.browser.page.form.mappedName";
Are you looking for this:
var anObj = eval(aStr);
?
Yes, this solution works as I was suggested by ChatGPT after several attempts. The final form I used is this:
function (elementAlias) {
// The prefix to be added before the alias of the element
var aliasPrefix = "Aliases.browser.page.form.";
// Retrieve the element through the alias
var element = eval(aliasPrefix + elementAlias);
// Interact with the element
element.Click();
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> as I was suggested by ChatGPT after several attempts.
Funny 🙂
Just curious what your request succeeded? (I.e. whether ChatGPT already processed this Community or it was solution from some other forum/for some other language.)
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AlexKaras wrote:Hi,
> as I was suggested by ChatGPT after several attempts.
Funny 🙂
Just curious what your request succeeded? (I.e. whether ChatGPT already processed this Community or it was solution from some other forum/for some other language.)
Hello,
to be honest, it is not very knowledgeable about TestComplete, often providing incorrect or inapplicable solutions, probably its information on the subject is scarce and incomplete.
(This post is its translation from italian) 😁
