Inconsistent XPath locator behaviour

RESOLVED INVALID

Status

defect
P2
normal
RESOLVED INVALID
4 years ago
10 months ago

People

(Reporter: joshin4colours, Unassigned)

Tracking

(Blocks 1 bug, {pi-marionette-server})

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150806001005

Steps to reproduce:

I ran the following test using py.test and python 2.7.6 on Windows 8.1 using Firefox Developer Edition version 41.0a2 (2015-08-06):
```
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
from time import sleep

import unittest

class TestBrowser(unittest.TestCase):
		
	def test_github_link(self):
		firefox_capabilities = DesiredCapabilities.FIREFOX
		firefox_capabilities['marionette'] = True
		firefox_capabilities['binary'] = 'C:\\Program Files (x86)\\Firefox Developer Edition\\firefox.exe'
		
		driver = webdriver.Firefox(capabilities=firefox_capabilities)
		
		driver.get('http://the-internet.herokuapp.com/')
	
		sleep(5)
		driver.find_element_by_xpath(".//a[@href='https://github.com/tourdedave/the-internet']").click();
				
		assert driver.title == 'tourdedave/the-internet'
		
		driver.quit()

	def test_dropdown_link(self):
		firefox_capabilities = DesiredCapabilities.FIREFOX
		firefox_capabilities['marionette'] = True
		firefox_capabilities['binary'] = 'C:\\Program Files (x86)\\Firefox Developer Edition\\firefox.exe'
		
		driver = webdriver.Firefox(capabilities=firefox_capabilities)
		
		driver.get('http://the-internet.herokuapp.com/')
	
		sleep(5)
		driver.find_element_by_xpath(".//a[@href='/dropdown']").click();
		sleep(2)
		assert driver.find_element_by_xpath('//select').is_displayed()
		
		driver.quit()	
```


Actual results:

When run, test_dropdown_link() passed but test_github_link() failed.


Expected results:

Both tests should've passed. They both contain similar xpath locators to find and click elements on the page.

This may be related to unescaped characters in the test_github_link() locator strings but both of these test methods should pass.
Whiteboard: [marionette=1.0]

Comment 1

3 years ago
This appears to be a non-issue to me. If anything, Firefox should cause an exception here because the link is "not clickable"; It is clickable but because of some CSS tricks, there's no way for Marionette nor any other driver to figure that out.

Firefox 48.0

```
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait

caps = DesiredCapabilities.FIREFOX

caps["marionette"] = True
caps["binary"] = "/Applications/Firefox48.app/Contents/MacOS/firefox-bin"

ff = webdriver.Firefox(capabilities=caps)
ff.get("http://the-internet.herokuapp.com/")

ff_the_internet = ff.find_element_by_xpath(".//a[@href='https://github.com/tourdedave/the-internet']")
ff_the_internet.click()  # DOES NOT CLICK

ff_the_internet.rect  # {u'height': 19.0, 'value': None, u'width': 0.0, u'x': 1132.5, u'y': 16.5}
```

Compare that to Chrome latest:

```
chrome = webdriver.Chrome()
chrome.get("http://the-internet.herokuapp.com/")

chrome_the_internet = chrome.find_element_by_xpath(".//a[@href='https://github.com/tourdedave/the-internet']")
chrome_the_internet.click()  # WebDriverException

chrome_the_internet.rect  # WebDriverException
```

ChromeDriver provides this exception:
```
WebDriverException: Message: unknown error: Element is not clickable at point (123, 32). Other element would receive the click: <div id="content" class="large-12 columns">...</div>
  (Session info: chrome=52.0.2743.116)
  (Driver info: chromedriver=2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0),platform=Mac OS X 10.11.6 x86_64)
```
Blocks: webdriver
OS: Unspecified → All
Priority: -- → P2
Hardware: Unspecified → All
Whiteboard: [marionette=1.0]
Version: unspecified → Trunk
Summary: Inconsistent Xpath Locator behaviour in Marionette On Windows → Inconsistent XPath locator behaviour
Basically this bug is invalid as already pointed out in comment 1. The element can perfectly be retrieved via the given XPATH locator. But it is not interactable. Firefox throws the following error those days:

> 1533038682926	Marionette	TRACE	3 -> [0,10,"WebDriver:FindElement",{"using":"xpath","value":".//a[@href='https://github.com/tourdedave/the-internet']"}]
> 1533038682946	Marionette	TRACE	3 <- [1,10,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"0640d55e-6496-b242-8b62-f0e101d656c5"}}]
> 1533038682950	Marionette	TRACE	3 -> [0,11,"WebDriver:ElementClick",{"id":"0640d55e-6496-b242-8b62-f0e101d656c5"}]
> 1533038682991	Marionette	TRACE	3 <- [1,11,{"error":"element not interactable","message":"Element <a href=\"https://github.com/tourdedave/the-internet\"> could no ... :524:3\nregisterSelf@chrome://marionette/content/listener.js:458:5\n@chrome://marionette/content/listener.js:1681:1\n"},null]

I will file a separate bug to fix the unexpected "could not be scrolled into view" message, because this element is absolutely positioned and clearly visible.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.