au3WebDriver icon indicating copy to clipboard operation
au3WebDriver copied to clipboard

Shadow Root support

Open Danp2 opened this issue 5 years ago • 20 comments

https://bugzilla.mozilla.org/show_bug.cgi?id=1489490&GoAheadAndLogIn=1

Danp2 avatar Sep 26 '19 23:09 Danp2

https://github.com/w3c/webdriver/issues/350#issuecomment-718120114

Danp2 avatar Oct 28 '20 18:10 Danp2

PR has been submitted to support Shadow Root in the W3C specs. Will update _WD_GetShadowRoot once this gets finalized

Danp2 avatar Jan 10 '21 16:01 Danp2

_WD_GetShadowRoot has been updated. Still needs to be implemented in geckodriver (https://bugzilla.mozilla.org/show_bug.cgi?id=1700095)

Danp2 avatar Jan 28 '21 15:01 Danp2

Chromedriver implementation tracking -- https://bugs.chromium.org/p/chromedriver/issues/detail?id=3715

Danp2 avatar Mar 05 '21 17:03 Danp2

Latest revisions tested successfully with Chrome. Still waiting for Geckodriver to be updated.

Danp2 avatar Dec 25 '21 17:12 Danp2

Latest revisions tested successfully with Chrome. Still waiting for Geckodriver to be updated.

After it is updated, will it still be necessary to implement corrections in this respect to this UDF? Or are we just waiting to close this ISSUE to test whether the solution introduced into the UDF worked?

mlipok avatar Jan 07 '22 15:01 mlipok

I don't believe any further modifications are required, but I'm stating that without reviewing the existing code.

Danp2 avatar Jan 07 '22 15:01 Danp2

From the Geckodriver 0.31.0 change log --

### Added

- Support for [Get Element Shadow Root]

  Implemented by [David Burns].

  The standardised WebDriver [Get Element Shadow Root] endpoint provides a way
  to retrieve the Shadow Root of a given web element. This endpoint is
  supported by geckodriver when using Firefox version ≥96.

Danp2 avatar Apr 11 '22 10:04 Danp2

The given issue https://github.com/w3c/webdriver/issues/350

has been closed.

How this relates on our work here ?

mlipok avatar Jul 13 '22 10:07 mlipok

@mlipok It doesn't change anything. Leaving this open until further testing is performed with the various webdrivers.

Danp2 avatar Jul 13 '22 13:07 Danp2

_WD_GetShadowRoot seems to be working good on all browsers. Used this code for testing --

Func UserTesting() ; here you can replace the code to test your stuff before you ask on the forum
        _WD_Navigate($sSession, "https://component.kitchen/elix/Tabs")
	$sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//elix-tabs[@id='sampleTabs']")
	$sDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "#explorerContainer", $sRoot)
	$sRoot2 = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "#proxyList", $sDiv)
;~ 	Exit
EndFunc   ;==>UserTesting

Danp2 avatar Jul 14 '22 17:07 Danp2

@mlipok It doesn't change anything. Leaving this open until further testing is performed with the various webdrivers.

It was game changer, as I see. Now we will be able to close this issue. ;)

mlipok avatar Jul 14 '22 19:07 mlipok

Seems to be working good on all browsers. Used this code for testing --

Func UserTesting() ; here you can replace the code to test your stuff before you ask on the forum
        _WD_Navigate($sSession, "https://component.kitchen/elix/Tabs")
	$sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//elix-tabs[@id='sampleTabs']")
	$sDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "#explorerContainer", $sRoot)
	$sRoot2 = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "#proxyList", $sDiv)
;~ 	Exit
EndFunc   ;==>UserTesting

Will check ASAP. currently on phone

mlipok avatar Jul 14 '22 19:07 mlipok

Here is revised code for testing shadow root support in _WD_FindElement --

Func UserTesting() ; here you can replace the code to test your stuff before you ask on the forum
    _WD_Navigate($sSession, "https://component.kitchen/elix/Tabs")
    $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//elix-tabs[@id='sampleTabs']")
    $sDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "#explorerContainer", $sRoot, Default, True)
    $sRoot2 = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "#proxyList", $sDiv)
;~  Exit
EndFunc   ;==>UserTesting```

Danp2 avatar Jul 17 '22 14:07 Danp2

Firefox

_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=xpath    Selector=//elix-tabs[@id='sampleTabs']    StartElement=Default
__WD_Post ==> Unknown Command [16] : HTTP status = 405
_WD_FindElement ==> Unknown Command [16] : Parameters:   Strategy=css selector   Selector=#explorerContainer   StartNodeID=fe590b11-4957-4f21-b5d9-99351b274625   Multiple=Default   ShadowRoot=True
__WD_Post ==> No match [8] : HTTP status = 404
_WD_FindElement ==> No match [8] : Parameters:   Strategy=css selector   Selector=#proxyList   StartNodeID=   Multiple=Default   ShadowRoot=Default
_WD_GetShadowRoot ==> No match [8] : Parameters:    Strategy=css selector    Selector=#proxyList    StartElement=

Chrome

_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=xpath    Selector=//elix-tabs[@id='sampleTabs']    StartElement=Default
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#explorerContainer   StartNodeID=eab9f36b-9864-461e-8d7e-2719ffd6e395   Multiple=Default   ShadowRoot=True
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#proxyList   StartNodeID=f3d9344d-6410-4e3a-a68f-6947f1f099d9   Multiple=Default   ShadowRoot=Default
__WD_Get ==> Success [0] : HTTP status = 200
_WD_ElementAction ==> Success [0] : Parameters:   Command=shadow   Option=Default
_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=css selector    Selector=#proxyList    StartElement=f3d9344d-6410-4e3a-a68f-6947f1f099d9

Edge

_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=xpath    Selector=//elix-tabs[@id='sampleTabs']    StartElement=Default
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#explorerContainer   StartNodeID=9d37a423-0a74-489a-96b2-14afaee431ec   Multiple=Default   ShadowRoot=True
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#proxyList   StartNodeID=1554f194-8ce4-4314-967b-96e8c8c0467e   Multiple=Default   ShadowRoot=Default
__WD_Get ==> Success [0] : HTTP status = 200
_WD_ElementAction ==> Success [0] : Parameters:   Command=shadow   Option=Default
_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=css selector    Selector=#proxyList    StartElement=1554f194-8ce4-4314-967b-96e8c8c0467e

Opera

_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=xpath    Selector=//elix-tabs[@id='sampleTabs']    StartElement=Default
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#explorerContainer   StartNodeID=f29e3910-7255-4b26-abb1-b98bbcbc9118   Multiple=Default   ShadowRoot=True
__WD_Post ==> Success [0] : HTTP status = 200
_WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#proxyList   StartNodeID=2a4028a4-f4ef-4b91-b4af-ef7419649108   Multiple=Default   ShadowRoot=Default
__WD_Get ==> Success [0] : HTTP status = 200
_WD_ElementAction ==> Success [0] : Parameters:   Command=shadow   Option=Default
_WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=css selector    Selector=#proxyList    StartElement=2a4028a4-f4ef-4b91-b4af-ef7419649108

Danp2 avatar Jul 17 '22 14:07 Danp2

Firefox functionality still depends on bug 1700095

Danp2 avatar Jul 17 '22 14:07 Danp2

Here is revised code for testing shadow root support in _WD_FindElement --

Func UserTesting() ; here you can replace the code to test your stuff before you ask on the forum
    _WD_Navigate($sSession, "https://component.kitchen/elix/Tabs")
    $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//elix-tabs[@id='sampleTabs']")
    $sDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "#explorerContainer", $sRoot, Default, True)
    $sRoot2 = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "#proxyList", $sDiv)
;~  Exit
EndFunc   ;==>UserTesting```

Here is a screenshot for reference: image

mlipok avatar Jul 18 '22 09:07 mlipok

All looks fine (expect mentioned FF bug).

Please consider adding this snippet to wd_demo.au3 as DemoShadow function.

mlipok avatar Jul 18 '22 10:07 mlipok

I'd prefer to leave this out of wd_demo for the following reasons --

  • This is an advanced feature that most users won't need
  • Adds maintenance to project due to changing web pages

The wiki may be a better option.

Danp2 avatar Jul 18 '22 13:07 Danp2

So do you whether you intend to close this ticket or mark it as awaiting feedback (gecko driver fix for FF)

mlipok avatar Jul 18 '22 16:07 mlipok

There are some changes in: https://bugzilla.mozilla.org/show_bug.cgi?id=1700095

Maybe soon will be fixed.

Related: https://bugzilla.mozilla.org/show_bug.cgi?id=1821628 https://phabricator.services.mozilla.com/D172416#5677925

mlipok avatar Mar 14 '23 13:03 mlipok

Is this related to our case ? https://github.com/w3c/webdriver/pull/1726

mlipok avatar Mar 16 '23 12:03 mlipok

@mlipok Seen it. That's why I made the change in #441 😉

Danp2 avatar Mar 16 '23 12:03 Danp2

_WD_GetShadowRoot has been updated. Still needs to be implemented in geckodriver (https://bugzilla.mozilla.org/show_bug.cgi?id=1700095)

Looks like this fix just landed for Firefox. Will need to confirm once v113 is released.

Danp2 avatar Mar 17 '23 12:03 Danp2

Geckodriver has been updated. FF v113 is still a month from release, but it can be tested using the Nightly release.

Danp2 avatar Apr 03 '23 12:04 Danp2

Geckodriver has been updated. FF v113 is still a month from release, but it can be tested using the Nightly release.

https://github.com/mozilla/geckodriver/releases/tag/v0.33.0 https://www.autoitscript.com/forum/topic/208633-webdriver-udf-w3c-compliant-version-20230326/?do=findComment&comment=1516289

mlipok avatar Apr 05 '23 08:04 mlipok

version 112 was released. https://www.mozilla.org/en-US/firefox/112.0/releasenotes/

https://www.mozilla.org/en-US/firefox/releases/

mlipok avatar Apr 12 '23 12:04 mlipok

Please also take a look here: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/112

Element and ShadowRoot references as stored in the node cache can now be used in both Marionette and WebDriver BiDi by their exact same unique reference. See [Firefox bug 1770733](https://bugzil.la/1770733) for more details.

mlipok avatar Apr 12 '23 12:04 mlipok

as to FF 113 (ships on [May 09, 2023]) https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/113

This article provides information about the changes in Firefox 113 that affect developers. Firefox 113 is the current [Beta version of Firefox](https://www.mozilla.org/en-US/firefox/channel/desktop/#beta) and ships on [May 09, 2023](https://wiki.mozilla.org/RapidRelease/Calendar#Future_branch_dates).

mlipok avatar Apr 12 '23 12:04 mlipok

Tested with FF113 --

    _WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=xpath    Selector=//elix-tabs[@id='sampleTabs']    StartElement=Default
    __WD_Post: URL=HTTP://127.0.0.1:4444/session/f805a670-be99-4523-8b62-a21ecc2870ca/shadow/46cf3f8b-e03e-48a1-b6ee-f5e95eb549a4/element; Data={"using":"css selector","value":"#explorerContainer"}
    __WD_Post ==> Success [0] : HTTP status = 200 ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"42100b60-523e-4068-b763-c3b88bb67b61"}}
    _WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#explorerContainer   StartNodeID=46cf3f8b-e03e-48a1-b6ee-f5e95eb549a4   Multiple=Default   ShadowRoot=True
    __WD_Post: URL=HTTP://127.0.0.1:4444/session/f805a670-be99-4523-8b62-a21ecc2870ca/element/42100b60-523e-4068-b763-c3b88bb67b61/element; Data={"using":"css selector","value":"#proxyList"}
    __WD_Post ==> Success [0] : HTTP status = 200 ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"4da05632-0626-41ca-9cda-4cabe6ce1449"}}
    _WD_FindElement ==> Success [0] : Parameters:   Strategy=css selector   Selector=#proxyList   StartNodeID=42100b60-523e-4068-b763-c3b88bb67b61   Multiple=Default   ShadowRoot=Default
    __WD_Get: URL=HTTP://127.0.0.1:4444/session/f805a670-be99-4523-8b62-a21ecc2870ca/element/4da05632-0626-41ca-9cda-4cabe6ce1449/shadow
    __WD_Get ==> Success [0] : HTTP status = 200 ResponseText={"value":{"shadow-6066-11e4-a52e-4f735466cecf":"5b186fb5-be7c-4c64-9bed-450d9294e12e"}}
    _WD_ElementAction ==> Success [0] : Parameters:   Command=shadow   Option=Default
    _WD_GetShadowRoot ==> Success [0] : Parameters:    Strategy=css selector    Selector=#proxyList    StartElement=42100b60-523e-4068-b763-c3b88bb67b61

Danp2 avatar May 09 '23 16:05 Danp2