Jump to content

Recommended Posts

Posted

I'm using Au3WebDriver 1.5.0 and AutoIt 3.3.14.5

I'm trying to interact with our ServiceNow page but I can only access a few top most controls.

Only the first _WD_FindElement below works as it's just before the #shadow-root, everything after that can't be found

_WD_Navigate($sSession, $sDirectLink)
_WD_LoadWait($sSession, 5000, 30000)
$eID = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/macroponent-f51912f4c700201072b211d4d8c26010")  ;This is the last item that can be found
;How to use this JS Path?  document.querySelector("body > macroponent-f51912f4c700201072b211d4d8c26010").shadowRoot.querySelector("div > sn-canvas-appshell-root")
$eID = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body > macroponent-f51912f4c700201072b211d4d8c26010 > div > sn-canvas-appshell-root")    ;_WD_FindElement ==> No match [8]
$eID = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/macroponent-f51912f4c700201072b211d4d8c26010//div/sn-canvas-appshell-root]')    ;_WD_FindElement ==> Invalid Expression [11]
$eID = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/macroponent-f51912f4c700201072b211d4d8c26010/./div/sn-canvas-appshell-root") ;trying . in the blank selector spot.  _WD_FindElement ==> No match [8]

The actual controls I want are stored under MANY nested #shadow-root (Open) items that can't be found. Each find just returns "_WD_FindElement ==> No match [8]"

 

When I copied the JS Path from the Edge Inspect, that at least shows the .shadowRoot but I don't know how to use this JS Path as part of the _WD_FindElement?

document.querySelector("body > macroponent-f51912f4c700201072b211d4d8c26010").shadowRoot.querySelector("div > sn-canvas-appshell-root")
 

ShadowRoot.jpg

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...