For some reason, I am not able to see how the id 201481050 is stored in the HTML.
Not sure whether the screenshot will be useful but that’s what I see when I inspect it at my end.
For some reason, I am not able to see how the id 201481050 is stored in the HTML.
Not sure whether the screenshot will be useful but that’s what I see when I inspect it at my end.
Unfortunately it’s not working. Getting Lead value is the problem here
It’s useless.
Let’s be clear, Inspect in this context is a reference to the browser’s Inspect function offered by the right-click menu on a web page.
I don’t believe that Inspecting an element on a web page the browser chooses to show you an element (<title>
in this case) which is found inside the <head>
element which contains nothing visible on the page.
So, please try again. Right click on and show us the resultant HTML from the DOM.
Hi Russ,
For some reason, was not abe to inspect it using Firefox, tried it with Chrome and this is what I see:
Do you know if the input’s id attribute is static. If it is, then for the element’s xpath use:
id("C28_W97_V99_V100_V101_btadminh_struct.object_id")
I’m not sure, so for me to assist you in creating a solid xpath to your input element, I might start at the label, ID, and traverse to the input–or you can run the page again to see if the same id shows or snag more HTML that displays the label and input elements.
String sLeadID_Accept = WebUI.getAttribute(findTestObject('Harmony_OR/Page_finally/input_AcceptID'), 'value')
WebUI.comment("Lead ID is: ${sLeadID_Accept}")
We need to see this page opened in browser in action. However this url seems to be configured to be private; you can see it but others on the public Internet can not.
You can save this page into a single file (MIME HTML format), and share it by attaching the *.mht file to this topic.
How to save the page as a MHT file?
You can do it quite easily by Chrome.
open the target URL in Chrome.
right-click on the page. you will see “Save As” menu, choose it
.mht
. This is the MIME HTML file of the target page.You want to double click the .mht file. Browser (Edge? Chrome) will open and the frozen copy of the target page will come up.
If you share this *.mht file to others, they would certainly be able to see the page on their side!
Please make sure before you actually sharing the file to us
Thanks for the detailed explanation of how to save the page. Sharing the file below:
https://ict.wdf.sap.corp/sap(bD1lbiZjPTAwMSZkPW1pbg==)/bc/bsp/sap/crm_ui_start/default.htm
The id generated is a dynamic value which needs to be captured everytime the script is getting executed
If the URL is redirecting to the home screen, under ‘Recent Items’ click on the file name:
and it will take you to the page in which the dynamic ID has to be captured:
the input id is dynamically generated
I am one Katalon users, I think that we are able to capture the value of the ID. Because I cannot access to your page so that I just provide idea I simulate from my side, base on that you can apply in your situation
See screenshot below:
Imaging that the text ‘Login’ is the static label ‘Id’
Imaging that the text ‘Please login to make appointment.’ is your dynamic id
The point here is to capture object dynamic id
Because the Id is dynamic, we cannot known the rule to generate that number so that we cannot capture its directly. However, the text ‘Id’ is static, and it is rarely to change to another one. So, we can capture the text Id first. Then, identify the relationship between the static text ‘label’ and dynamic id (based on xpath)
Once again, we capture object dynamic id based on the unchanged object (this case we use label Id)
Here is the xpath we need to find://h2[normalize-space(.)=‘Login’]/following-sibling:: p
Based on that ide, for your case, find the unchanged object first then use it to find your id
Hope it is useful.
FYI
No, you haven’t shared a file.
You shared a URL of your web site again, which is not available to others.
The file format (.mhtml) is not being supported here
Why not put the file into a .zip file and share the archive here
Thank you for sharing the MIME HTML of the target web page.
I could see the HTML of your target. I looked at the HTML source. I was surprised to find the HTML is terribly complex. This page is one of the most difficult HTMLs to test that I have ever seen.
<iframe>
in which <frameset>
tags are located. <frameset>
tags are even nested!<thtmlb:grid xmlns:thtmlb="CRMThinHTMLBLibrary"
.<table>
tags to control the layout of the page presentation. I guess, this HTML was initially developed at least 20 years ago.id
or name
attribute. So you have to use tricky technique. You would start with locating a certain element with some handy identification, then you would navigate to the target element using some XPath axis (following-sibling::
etc).This page is created by “SAP”. Oh, it’s a great HTML — I would never be able to develop such mess.
I am 100% sure that the Katalon’s Spy & Recorder tools can not deal with this complex HTML. The Test Objects generated by these tools will never work. You shouldn’t expect Recorder to help you for this page.
The target HTML contains a code fragement like this:
<thtmlb:grid xmlns:thtmlb="CRMThinHTMLBLibrary" cellspacing="1" columnsize="1" height="100%" rowsize="2" width="100%">
<thtmlb:gridcell colspan="1" columnindex="1" rowindex="1" rowspan="1">
...
</thtmlb:gridcell>
</thtmlb:grid>
Here you can find a code fragment xmlns:thtmlb="CRMThinHTMLBLibrary"
— this is called XML Namespace.
I tried to find how to write a XPath that can select the node
<thtmlb:grid xmlns:thtmlb="CRMThinHTMLBLibrary"
See https://github.com/kazurayam/saumil.sah/blob/master/Scripts/TC1/Script1650410352052.groovy for my code. But I couldn’t. I think that the XPath expression
//*[local-name()='grid']
should work, but actually it doesn’t. I do not see why.
The element containing the text “201481050” is located under the <thtmlb:grid>
element. Therefore, I think, any attempt to get access to the element using WebUI.getAttribute()
and any other WebUI Keywords will fail. … Of course, some else other than me may find a way to select the target node. Who knows.
I fear this HTML by SAP. I do not like to touch it anymore.
I would advise you to abandon the idea of testing this page using Katalon Studio.
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 wanted to clarify why my code does not work.
I made another Test Case
By a study backed by the TC3, I believe I have found out a fact.
I could not grasp a DOM node of <FRAMESET>
, <FRAME>
and whole descendant nodes.
@saumil.sah You could use Selenium code directly (it seems) but there’s a huge caveat to doing that.
If you know ahead of time that the page is built using broken, non-standard, deprecated elements, what will you do if your test passes?
If you say “it’s a pass!”, you’re lying. It’s NOT A PASS. The page is broken from the get go.
What will you do if it’s a fail? Well, you knew it was a fail even before you ran the test!
So, BE WARNED.
With that said, take a look here:
Disclaimer: I cannot vouch for any of that code.
Thank you for your input.
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.
I try with this xpath and I see it works
(//td/div/span/label[normalize-space(.) = ‘ID:’]/parent::span/parent::div/parent::td/following-sibling::td[@class=‘ch-grid-cell’])//span"
If you want to get value of ID: column, using text as ‘ID:’
If you want to get value of Description, change xpath, replace ‘ID:’ by ‘Description:’
FYI