Hi Katalon experts,
I’m pretty new using Katalon and I want to get the value from a class. When I spy the object from the web I get the below xpath value in attributes:
id(“block-company-website-account-menu”)/ul[@class=“menu”]/li[@class=“menu-item stock-ticker”]/div[@class=“stock-values”]/span[@class=“price”]
I want to get the value for class “price” that is changing daily.
Thanks and regards,
Ruben B
By the looks of it you need…
Description Get the visible (i.e. not hidden by CSS) inner text of the web element, including sub-elements, without any leading or trailing whitespace. Parameters Param Param Type Mandatory Description...
Hi Russ,
Thanks for your help! I already tried that and it works while the text is the same but it will fail tomorrow that the value changes.
Thanks,
Ruben B
Let’s be clear about the terminology: “value” is not the same as “text”. With the limited amount of information you have provided, I think you’re looking for the text. If that is so and your xpath is correct, then the text (within the span element) whatever it is , will be returned by getText
.
If that is not the case, then you’re not providing enough info. Read this and follow the advice.
My test is BROKEN! NOTHING WORKS! HELP ME!
Relax. We get it. We really do. There are some pretty smart and clever people on this forum, but you must realize, they are not magicians or wizards or gods. They cannot see your code, they can’t see your errors and they don’t even know what your AUT is meant to do even though it might seem perfectly obvious to you.
So please relax and follow the advice below, before you start writing your post. The advice below will tell you the exact information …
If get text is not working try using attribute to get text.
getText= WebUI. getAttribute ( findTestObject (‘TestObject/Details’), ‘value ’)
System. err.println('Text is: ’ + getText)
Hi Everybody,
Thanks for your help, you were right, it was gettext and i was able to get it.
Thanks,
Ruben B