Closed Bug 1489490 Opened 6 years ago Closed 3 years ago

Returning shadowRoot of an element in execute script causes a "cyclic object value" failure

Categories

(Remote Protocol :: Marionette, defect, P3)

defect

Tracking

(firefox96 fixed)

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: steffen.harbich, Assigned: david.burns)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 Build ID: 20180830143136 Steps to reproduce: With Selenium for Java execute script "return arguments[0].shadowRoot" on a Vaadin Flow application (uses shadow DOM polyfill). Please execute my attached gradle project via "./gradlew test". It opens "https://bakery-flow.demo.vaadin.com/login" and tries to get the "shadowRoot" of the Vaadin text field with id "username". Tested with FF 62, geckodriver v0.21.0-win64, Selenium 3.14.0. The issue https://bugzilla.mozilla.org/show_bug.cgi?id=1447977 might be related. Actual results: An error occurs when running the line WebElement shadow = (WebElement) ((JavascriptExecutor) driver).executeScript("return arguments[0].shadowRoot", element); Error: org.openqa.selenium.JavascriptException: Cyclic object value Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: 'ITCDENSTHA02', ip: '10.0.75.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_152' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 62.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 14040, moz:profile: C:\Temp\rust_mozprofile.jzt..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}} Session ID: 146eed1d-9fc0-410e-9940-7619ee1be94c Expected results: The WebElement "shadowRoot" should be returned without errors.
Assignee: nobody → testing
Component: Untriaged → QA Test Scripts
Product: Firefox → Bugzilla
QA Contact: default-qa
Version: 62 Branch → unspecified
Assignee: testing → nobody
Component: QA Test Scripts → geckodriver
Product: Bugzilla → Testing
QA Contact: default-qa
Please note that shadowRoot is not covered by the WebDriver spec yet. As such it will take a bit of time until level 2 of the spec has been discussed. See https://github.com/w3c/webdriver/issues/350 for the ShadowRoot support in general.
Status: UNCONFIRMED → NEW
Component: geckodriver → Marionette
Ever confirmed: true
Summary: "Cyclic object value" execute script in Selenium → Returning shadowRoot of an element in execute script causes a "cyclic object value" failure
Ok. However, as far as I know shadow DOM is not supported in FF 62 and therefor polyfilled by Vaadin Flow. So I would guess that it should be possible to retrieve that attribute "shadowRoot" as WebElement with no special meaning to FF?
For details please see https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM, and I missed that you were using Firefox 62. So, please test again with Firefox 63 which is currently on beta.
Priority: -- → P5
FF 63 is out now and I tested it again, still producing the same problem (see below), even with latest Selenium and gecko drivers. Can you please have a look into it? org.openqa.selenium.JavascriptException: Cyclic object value Build info: version: '3.141.0', revision: '2ecb7d9a', time: '2018-10-31T20:09:30' System info: host: 'ITCDENSTHA02', ip: '10.0.75.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_152' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 63.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 3640, moz:profile: C:\Temp\rust_mozprofile.rWy..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10.0, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify} Session ID: 6e9d62e3-5eec-4cde-af21-c02dd19c2d12 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:489) at se.bettercode.seleniumstarter.MyFirstTest.goToWebPage(MyFirstTest.java:27)
Returning the shadowRoot is not supported in WebDriver.

We have the same error with RobotFramework and SeleniumLibrary, we can qualified our products on Chrome but not on Firefox.
OS: Linux x64
GeckoDriver: 0.26.0
Firefox: 77.0.1

This works as expected now in Firefox Nightly and should also do in the upcoming Firefox 96 beta since the patch from bug 1700073 has been landed. Here the excerpt of the trace log for the test case as mentioned in comment 0::

1638879298664	Marionette	DEBUG	3 -> [0,3,"WebDriver:FindElement",{"value":"vaadinLoginUsername","using":"id"}]
1638879298787	Marionette	TRACE	[22] MarionetteCommands actor created for window id 2147483650
1638879298794	Marionette	DEBUG	3 <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"14499b12-ec8d-410f-b77d-a563d190515e"}}]
1638879298799	Marionette	DEBUG	3 -> [0,4,"WebDriver:GetShadowRoot",{"id":"14499b12-ec8d-410f-b77d-a563d190515e"}]
1638879298812	Marionette	DEBUG	3 <- [1,4,null,{"value":{"shadow-6066-11e4-a52e-4f735466cecf":"6cae4c3e-3e09-4c1f-90da-f18d76ca137e"}}]
1638879298830	Marionette	DEBUG	3 -> [0,5,"WebDriver:ExecuteScript",{"script":"var elem = document.getElementById(\"vaadinLoginUsername\");\n            return elem.shadowRoot;","args":[],"newSandbox":true,"sandbox":"default","line":108,"filename":"_a/test_minimized.py"}]
1638879298836	Marionette	DEBUG	3 <- [1,5,null,{"value":{"shadow-6066-11e4-a52e-4f735466cecf":"6cae4c3e-3e09-4c1f-90da-f18d76ca137e"}}]

Note that geckodriver support for this will ship in the upcoming 0.31.0 release.

Assignee: nobody → david.burns
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: