webdriver
webdriver copied to clipboard
Get Element Property should run internal JSON clone algorithm on result before returning it
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.
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 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?