(1) HTML code of your target web page, especially elements of your interest. Open the URL with Browser, open the DevTool by F12 key and find the HTML source.
(2) The xpath code of the ‘MyObject’. Its screenshot is required.
It might be a surprise for you but in the built-in keywords of Katalon Studio, there is none which returns the contents of HTML elements as List. You need to develop some custom solution.
Awesome!
It seems like working, but throws the following error:
[ERROR] - Test Cases/Test1 FAILED because (of) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘[Name 1, Name 2, Name 3, Name 4, Name 5, Other Name 1, Other Name 2]’ with class ‘java.util.ArrayList’ to class ‘java.awt.List’ due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.awt.List(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Any idea?
Unfortunately I can’t upload screenshots of the HTML code, but I really appreciate your help!
I managed to solve it like this:
ArrayList Names = CustomKeywords.‘newkeywordpackage.FindElementsByXPath.getElementContentsAsList’(’//div[@class =" YourClass"]’)
Thanks for the help! I hope this will be useful for others too!