Skip to content

Commit 788f40c

Browse files
committed
firefox: Fixing "null pointer exception" in xpath location strategy. Fixes issue #714
1 parent e7b9414 commit 788f40c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

java/client/test/org/openqa/selenium/ElementFindingTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ public void testShouldBeAbleToFindElementByXPathWithNamespace() {
404404
assertThat(element.getText(), is("Test Chart"));
405405
}
406406

407+
@Ignore({IE, MARIONETTE, SAFARI, CHROME})
408+
@NotYetImplemented(HTMLUNIT)
409+
@Test
410+
public void testShouldBeAbleToFindElementByXPathInXmlDocument() {
411+
driver.get(pages.simpleXmlDocument);
412+
WebElement element = driver.findElement(By.xpath("//foo"));
413+
assertThat(element.getText(), is("baz"));
414+
}
415+
407416
// By.xpath negative
408417

409418
@Test(expected = NoSuchElementException.class)

javascript/atoms/locators/xpath.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bot.locators.xpath.evaluate_ = function(node, path, resultType) {
119119
for (var i = 0; i < allNodes.length; ++i) {
120120
var n = allNodes[i];
121121
var ns = n.namespaceURI;
122-
if (!reversedNamespaces[ns]) {
122+
if (ns && !reversedNamespaces[ns]) {
123123
var prefix = n.lookupPrefix(ns);
124124
if (!prefix) {
125125
var m = ns.match('.*/(\\w+)/?$');

0 commit comments

Comments
 (0)