rratchat
2 years agoNew Contributor
Cannot get a dynamic ID by using GetPropertyValue.
I have tried to get a dynamic ID by using GetPropertyValue, but it is not working.
Do you guys have any ideas?
...
let dropdownListBoxObject = screenObject.FindElement("/html/body/div[2]/div/div");
let uniqueId = aqObject.GetPropertyValue(dropdownListBoxObject, "id");
Log.Message("uniqueId: " + uniqueId);
...
e.g.
<div id="dx-7594ebcf-7777-3185-0afc-2e5cb15b2189" class="dx-scrollable dx-scrollview dx-visibility-change-handler dx-scrollable-vertical dx-scrollable-simulated dx-list dx-widget dx-collection" role="listbox">
It's always returned me uniqueId: 1.
Here's an example,
function w3schools() { // URL https://www.w3schools.com/html/tryit.asp?filename=tryhtml_id_css var page = NameMapping.Sys.browser.Page("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_id_css").Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult"); var item = page.TextNode("myHeader"); Log.Message(item.getAttribute("id")); }
Use getAttribute() method.
I think GetPropertyValue() is returning this value,