webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Get Element Property should run internal JSON clone algorithm on result before returning it

Open andreastt opened this issue 6 years ago • 2 comments

DOM properties could be complex objects, even elements. One can return properties using Get Element Property, but we don’t sanitise/serialise the data before returning it across the wire.

I’m assuming this is an omission and that the intended use case for Get Element Property is to allow returning any type that WebDriver supports serialising. The fix is simply to run the internal JSON clone algorithm on result before returning.

andreastt avatar Apr 17 '19 12:04 andreastt

True story.

Example: https://demoqa.com/automation-practice-form

driver.findElement(By.id("firstName")).getAttribute("validity") (Selenium 3) doesn't work on validity property (null) which is an object.

document.getElementById("firstName").validity outputs valid object

vinogradoff avatar Nov 21 '20 22:11 vinogradoff

@vinogradoff which browsers did you test? Is that with Chrome?

I'm trying to make the spec changes, and tested with Firefox. geckodriver correctly returns the object. Would you mind checking that?

whimboo avatar Nov 27 '20 10:11 whimboo