torus
2 years agoContributor
Web testing - Switch between using FindElement + Xpath to grab objects and using NameMap objects
Is there a way to use the 'FindElement' method for a NameMapping object? I thought (was hoping) the below code would work, but it does not. I read the 'FindElement' documentation and it says the Find...
- 2 years ago
You can use FindElement method on a mapped object. Not sure if this is a good example,
function TestX() { // URL: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_html_nested_table // Aliases.frameIframeresult = Sys.Browser("chrome").Page("https://www.w3schools.com/howto/tryit.asp?filename=tryhow_html_nested_table").Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult") var frame = Aliases.frameIframeresult; var table1 = frame.FindElement("/html/body/table"); Sys.HighlightObject(table1); var table2 = table1.FindElement("//*/td[2]/table"); Sys.HighlightObject(table2); var cells = table2.FindElements("//*/td[2]/table/tbody/tr"); for (var i = 0; i < cells.length; i++) { Sys.HighlightObject(cells[i]); } }