Closed Bug 1410796 Opened 7 years ago Closed 7 years ago

Unable to retrieve namespaced XML elements

Categories

(Remote Protocol :: Marionette, defect, P2)

58 Branch
defect

Tracking

(firefox-esr52 unaffected, firefox56 unaffected, firefox57 unaffected, firefox58 fixed)

RESOLVED FIXED
mozilla58
Tracking Status
firefox-esr52 --- unaffected
firefox56 --- unaffected
firefox57 --- unaffected
firefox58 --- fixed

People

(Reporter: barancev, Assigned: ato)

References

Details

(Keywords: regression)

Attachments

(5 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.webservicex.net/globalweather.asmx?wsdl");
driver.findElement(By.xpath("//*"));


Actual results:

org.openqa.selenium.WebDriverException: TypeError: Expected Element, SVGElement, WindowProxy, or XULElement, got: <definitions>
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'ALEXEI-PC', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\alexei\AppData\Local\Temp\rust_mozprofile.Y3AzvDOeZ4uY, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=XP, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=58.0a1, platformVersion=6.1, moz:processID=4356, browserName=firefox, javascriptEnabled=true, platformName=XP, moz:webdriverClick=true}]
Session ID: b257c24a-884d-4730-98b5-ed84f3f60af2
*** Element info: {Using=xpath, value=//*}



Expected results:

No exception, an element found.

Used to work in "58.0a1 (2017-09-28) (64-bit)", stopped to work about a week ago.
This might be a regression from the update of the Selenium atoms (bug 1375660). I will have a look soon.
Component: Untriaged → Marionette
Product: Firefox → Testing
So this is actually a regression from over the weekend. Here the pushlog:

https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=8eb244189e3836bbbde99f8c90df3c5bbc3b98cd&tochange=c2a7f25669f8054409e5ae0e1b545d409cb057b5

So this is a regression from the WebElement implementation on bug 1400256.

Andreas, can you please have a look?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(ato)
Keywords: regression
I assume that we have a general issue with XML documents at the moment and that this does not only affect find_element, or XPATH.
Henrik, is this something we should block the 58 release on?
Flags: needinfo?(hskupin)
Flags: needinfo?(ato)
Summary: WebDriver: findElement can't search XML document by XPath → Unable to retrieve namespaced XML elements
(In reply to Mike Taylor [:miketaylr] (58 Regression Engineering Owner) from comment #4)
> Henrik, is this something we should block the 58 release on?

Probably.

I will fix this tonight.
Assignee: nobody → ato
Status: NEW → ASSIGNED
Flags: needinfo?(hskupin)
OS: Unspecified → All
Priority: -- → P2
Hardware: Unspecified → All
Marionette does find the element, but is unable to add it to the
known web element store.  This is a result of the changes made in
https://bugzil.la/1400256, where we introduced a set of functions
for element type recognition needed for determining which web
element abstraction to use for an element.

It introduced a check for Node.namespaceURI matching either XHTML
(HTML), SVG, XUL, or XBL.  With namespaced XML documents—which
SVG is an example of—this method fails because we don’t know
the namespaceURI upfront for custom namespaces.  Instead we need to
moderate our approach in element.isDOMElement to recognise any HTML,
XHTML, or SVG element: its purpose is to distinguish a node from a
chrome-scoped node, such as a XULElement or an XBL bound attribute,
so this should be sufficient.  This means element.isSVGElement must
go away, which I think should be fine.
Comment on attachment 8923964 [details]
Bug 1410796 - element.isDOMElement to match any non-XUL element.

https://reviewboard.mozilla.org/r/195146/#review200468
Attachment #8923964 - Flags: review?(hskupin) → review+
Comment on attachment 8923965 [details]
Bug 1410796 - Drop element.isSVGElement.

https://reviewboard.mozilla.org/r/195148/#review200472

I like that removal given my original concerns for this method and elements in chrome context.
Attachment #8923965 - Flags: review?(hskupin) → review+
Comment on attachment 8923966 [details]
Bug 1410796 - Add nodeType existence check.

https://reviewboard.mozilla.org/r/195150/#review200474

::: testing/marionette/element.js:1099
(Diff revision 1)
>   *     false otherwise.
>   */
>  element.isXULElement = function(node) {
>    return typeof node == "object" &&
>        node !== null &&
> +      "nodeType" in node &&

You could also use `node.hasOwnProperty("nodeType")`.
Attachment #8923966 - Flags: review?(hskupin) → review+
Comment on attachment 8923967 [details]
Bug 1410796 - Test element retrieval from XHTML namespace.

https://reviewboard.mozilla.org/r/195152/#review200476

Please ask Maja for those changes of webplatform tests. I'm still not there yet.
Attachment #8923967 - Flags: review?(hskupin)
Attachment #8923967 - Flags: review?(mjzffr)
Comment on attachment 8923968 [details]
Bug 1410796 - Add basic evaluate.toJSON tests.

https://reviewboard.mozilla.org/r/195154/#review200480
Attachment #8923968 - Flags: review?(hskupin) → review+
Comment on attachment 8923967 [details]
Bug 1410796 - Test element retrieval from XHTML namespace.

https://reviewboard.mozilla.org/r/195152/#review200588
Attachment #8923967 - Flags: review?(mjzffr) → review+
Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c85a5a7b5a1c
element.isDOMElement to match any non-XUL element. r=whimboo
https://hg.mozilla.org/integration/autoland/rev/8522c3993c5b
Drop element.isSVGElement. r=whimboo
https://hg.mozilla.org/integration/autoland/rev/cefff31e8739
Add nodeType existence check. r=whimboo
https://hg.mozilla.org/integration/autoland/rev/3617d7a46b58
Test element retrieval from XHTML namespace. r=maja_zf
https://hg.mozilla.org/integration/autoland/rev/c34d538776d5
Add basic evaluate.toJSON tests. r=whimboo
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: