Forum Discussion
9 Replies
- MarcusBengtssonFrequent Contributor
- rraghvaniChampion Level 3
From what I remember, you can't use wildcards in XPath e.g. [@id='grid*'] but you should be able to use contains() or substring() - if you search for "javascript xpath contains" on the internet, you'll get plenty of results.
- MarcusBengtssonFrequent Contributor
Hii, is there anything I could use from here? There are 2 different checkboxes I need to fill in, one from parameter and one from monitoring configuration. The first one is doing fine, but when it comes to the monitoring configuration its not working since it changes name ๐
- rraghvaniChampion Level 3
Are you able to use the table cell, row and column values? What does the Object Spy tool show?
- MarcusBengtssonFrequent Contributor
This is
- MarcusBengtssonFrequent Contributor
I got this reply from developer when i asked if they could set a static id to make it easier for the test:
"Thatโs correct, the grid id gets generated at run time because Ids needs to be unique.
If we put some type of prefix before random Ids, would that help?
e.g. MonConfGridxxxxxx"
but I guess that would not solve that i still cannot use "MonConfGrid*" wildcard during xpath ๐
- rraghvaniChampion Level 3
Here's a few examples of using XPath to highlight the control not using full id name,
function test1() { // URL https://www.w3schools.com/html/tryit.asp?filename=tryhtml_id_css var page = Aliases.browser.Page("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_id_css").FindElement("#iframeResult"); var item = page.FindElement("//*[@id='myHeader']"); Sys.HighlightObject(item); var item = page.FindElement("//*[@id[starts-with(., 'my') and string-length() > 3]]"); Sys.HighlightObject(item); var item = page.FindElement("//*[starts-with(@id, 'my')]") Sys.HighlightObject(item); }
- MarcusBengtssonFrequent Contributor
Hmm thank you for the reply and help I will try to figure something out for the keyword tests out from this ๐ฎ
- rraghvaniChampion Level 3
It also works in keyword test
Related Content
- 7 years ago
- 6 years ago
- 2 years ago
- 4 years ago
- 2 years ago
Recent Discussions
- 2 days ago