Jens.gr
September 6, 2019, 10:00am
1
Hello,
Currently we are using JavaScript to get WebElements:
WebDriver driver = DriverFactory.getWebDriver()
WebElement ele = (WebElement) ((JavascriptExecutor)driver).executeScript("return document.querySelector("body......"))
Some of the elements are under ShadowRoots so a Xpath is not a option to convert the objects correctly.
Is there a way to convert the WebElements into Katalon TestObjects?
Unfortunately no, there’s no way to directly convert a WebElement
object to a TestObject
object. You can create TestObject
s programmatically in your script though:
def testObject = new TestObject(“object_name”)
testObject.addProperty(…)
See the documentation for more details on this.
1 Like
Ibus
September 8, 2019, 8:46am
3
Katalon does support working with sShadow DOM, see here:
https://docs.katalon.com/katalon-studio/docs/working-with-shadow-dom-objects.html
although not sure if it’s working with the latest chrome driver, but worth to try out.
1 Like
Jens.gr
September 16, 2019, 2:01pm
4
Thank you, did not stumbled over that documentation. a bit more work then i was hoping for but sure a way to get it working.