Forum Discussion
- rraghvaniChampion Level 3
Here's an example based on the following website https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_tr,
function Test() { var page = Aliases.browser.Page("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_tr").FindElement("#iframeResult") // Highlight Month var element = page.FindElement("/html/body/table/tbody/tr[1]/th[1]"); Sys.HighlightObject(element); // Highlight $80 var element = page.FindElement("/html/body/table/tbody/tr[3]/td[2]"); Sys.HighlightObject(element); }
It uses XPath to find the element and then highlights it.
- rraghvaniChampion Level 3
Another example, to highlight the cell using XPath base on the class name
- halovskiContributor
I am currently at
let tr = Aliases.browser.pagePostbank.FindElement("td[@id='m_img_Edit_5be1669f1f644960a895de91534a50f8']")Its xpath is /html/body/form/div[3]/control/div/div/div[2]/div/div/div/div[1]/div/table/tbody/tr[15]/td[1]/div/a
I don't know if I have to use the full path or not. Missclicked the solution button sorry about that
- halovskiContributor
Can you please just give me an example with this ID:
id="m_img_Edit_5be1669f1f644960a895de91534a50f8"
I tried to write the ID in a few ways and none of them worked. What specifically would I have to write in the FindElement for it to get located?
let img = Aliases.browser.FindElement("id...")
- rraghvaniChampion Level 3
Using ID,
will highlight the first row
- halovskiContributor
Thank you so much, my problem was the xpath //tr[@id=.
So I don't start another thread, how can I put my variable inside the xpath like I can do in javascript.
("//tr[@id='My variable here']")
I tried ${} ("//tr[@id='${My variable here}']") like in javascript and that didn't help
- rraghvaniChampion Level 3
For example,
var myVar = "m_img_Edit_5be1669f1f644960a895de91534a50f8" var xpathStr = "//*[@id='" + myVar + "']"; var element = page.FindElement(xpathStr);
Related Content
- 5 years ago