I concur. SAP HTML is the worst possible thing to test. They should be hung from the rafters for using DEPRECATED framesets (nested too!) and all manner of idiotic contrivances designed to obfuscate and confuse. Not only that, they’re using cross-origin iframe sources making it very difficult to debug using industry standard tools like DevTools.
Sorry, @saumil.sah, but I don’t have time to waste on this mess. I pity you having to work with crap like this – you deserve and have my sympathy.
Take this thread and show it to your manager. Tell him to show it to his manager. And if they blame Katalon and tell you to look for something else, tell them I didn’t use Katalon, I used a BROWSER and DEVTOOLS. I wouldn’t even try to use Katalon until a browser and DevTools can make sense of it.
I tried to learn the link you provided and tried to find a solution for the original post, but I couldn’t after a few hours of struggle. Well, it is too difficult and tiresome for me to test a HTML with FRAMESET.
You tried that xpath in the console tab of Chrome’s DevTools with $x() function, and you wrote “it works”.
I am afraid your post does not answer to the original poster @saumil.sah. He asked how to write a Test Case script in Katalon Studio to test the SAP HTML. He did not ask us how to write $x() function in the DevTool console. These are 2 different problems.
When I tried to write a Test Case, I found a difficulty for “WebUI.switchToFrame()” for <FRAMESET> tags.
When you interacted with the DevTools console, you manually did operation equivalent to “WebUI.switchToFrame()”. It seems that your view point in the DevTool successfully passed the wall of <FRAMESET> and you could reach to the target HTML document. Then you applied $x() function and found it works. Ok, it’s nice to know this. But $x() in the DevTool doesn’t solve the problem of original post.
Original driver can switch the IFrame so I guess that we can switch to them, then we can continue to find the xpath. On previous comment of @saumil.sah “The id generated is a dynamic value which needs to be captured everytime the script is getting executed”, I saw some comment related to this dynamic object
Please try with switching into FRAMESET by WebUI.switchToFrame() keyword or WebDriver.switchTo().frame(id)
I did try it and failed.
I think that the solution is, surprisingly, not the same as IFrame. At least, not as simple as users expect.
As @Russ_Thomas pointed out, <FRAMESET> has been depreceted and not supported in HTML5. I would not be surprised to find any curiosities about FRAMESET.
After executing, I am able to see the attribute of last frame that means we have just by passed the FRAMESET. The ide here is Selenium not support switch FRAMESET but we can identify it by tag then switch to its frame
Now, we resolve the FRAMESET problems, please try with remaining frame (same approach)
You wrote you got an error. If so, your code must be somehow different from my code, or your Application Under Test is somewhat different form the MHTML you provided to us. But I can not see what.
Hi @kazurayam! The solution works. Had to make a small tweak, wherein had to close the browser and open it again and navigate to the page via some other channel! Really a pain to capture things in this HTML layout.
Thanks to other members here as well for giving their thoughtful insights! Hands down the best community out there