Open
Bug 1453779
Opened 6 years ago
Updated 1 year ago
TypeError: rect is undefined, when using Selenium Actions and element is not displayed.
Categories
(Remote Protocol :: Marionette, defect, P3)
Tracking
(Not tracked)
NEW
People
(Reporter: b4hand, Unassigned)
References
()
Details
Attachments
(1 file)
1.76 KB,
text/html
|
Details |
pytest Log: https://gist.github.com/jrbenny35/676ea5f424ed31467d7d6167f0d8aafe Geckodriver Log: https://gist.github.com/jrbenny35/32c7967d01c6d615f7e6945f83a5340f Test case: ``` user = self.find_element(*self._user_locator) logout = self.find_element(*self._logout_locator) action = ActionChains(self.selenium) action.move_to_element(user) action.move_to_element(logout) action.click() action.perform() ``` Selenium will fail on the ```action.perform()``` step with an error of: ```WebDriverException: Message: TypeError: rect is undefined```.
Comment 1•6 years ago
|
||
The actual stacktrace:
> element.getInViewCentrePoint@chrome://marionette/content/element.js:1163:5
> getElementCenter@chrome://marionette/content/action.js:1432:12
> dispatchPointerMove/<@chrome://marionette/content/action.js:1320:18
> dispatchPointerMove@chrome://marionette/content/action.js:1316:10
> toEvents/<@chrome://marionette/content/action.js:1103:16
> action.dispatchTickActions@chrome://marionette/content/action.js:1013:23
> action.dispatch/chainEvents<@chrome://marionette/content/action.js:981:13
> async*action.dispatch@chrome://marionette/content/action.js:979:22
> performActions@chrome://marionette/content/listener.js:790:9
> async*dispatch/</req<@chrome://marionette/content/listener.js:493:14
> dispatch/<@chrome://marionette/content/listener.js:486:15
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
Comment 2•6 years ago
|
||
The log shows that Firefox 60.0a1 has been used for running the tests. This is kinda outdated, and I assume that a bug like that has been fixed a long time ago. Benjamin, please re-test after upgrading Firefox.
Flags: needinfo?(bforehand)
Comment 3•6 years ago
|
||
getElementCenter in testing/marionette/action.js:1437 suggests that
the element doesn’t have any client rects:
> function getElementCenter(el, window) {
> if (element.isDOMElement(el)) {
> if (action.specCompatPointerOrigin) {
> return element.getInViewCentrePoint(el.getClientRects()[0], window);
> }
> return element.coordinates(el);
> }
> return {};
> }
I’m trying to think of which elements might not have client rects
but it is too early in the morning and I haven’t had a coffee yet.
Can you please provide an minimal HTML document showcasing the
problem?
Reporter | ||
Comment 4•6 years ago
|
||
Here is a log running Firefox 61.0a1: https://gist.github.com/jrbenny35/023ed2d2744c0044f0c79532552952cd > {element.getInViewCentrePoint@chrome://marionette/content/element.js:1162:5 > getElementCenter@chrome://marionette/content/action.js:1440:14 > dispatchPointerMove/<@chrome://marionette/content/action.js:1327:18 > dispatchPointerMove@chrome://marionette/content/action.js:1323:10 > toEvents/<@chrome://marionette/content/action.js:1110:16 > action.dispatchTickActions@chrome://marionette/content/action.js:1020:23 > action.dispatch/chainEvents<@chrome://marionette/content/action.js:989:13 > async*action.dispatch@chrome://marionette/content/action.js:987:22 > performActions@chrome://marionette/content/listener.js:786:9 > async*dispatch/</req<@chrome://marionette/content/listener.js:491:14 > dispatch/<@chrome://marionette/content/listener.js:484:15 > MessageListener.receiveMessage*startListeners@chrome://marionette/content/listener.js:554:3 > registerSelf@chrome://marionette/content/listener.js:465:5 > @chrome://marionette/content/listener.js:1697:1\n"}
Flags: needinfo?(bforehand)
Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Andreas Tolfsen ‹:ato› from comment #3) > getElementCenter in testing/marionette/action.js:1437 suggests that > the element doesn’t have any client rects: > > > function getElementCenter(el, window) { > > if (element.isDOMElement(el)) { > > if (action.specCompatPointerOrigin) { > > return element.getInViewCentrePoint(el.getClientRects()[0], window); > > } > > return element.coordinates(el); > > } > > return {}; > > } > > I’m trying to think of which elements might not have client rects > but it is too early in the morning and I haven’t had a coffee yet. > > Can you please provide an minimal HTML document showcasing the > problem? The website I am testing against is https://addons.mozilla.org. You must login using the 'Log In' button on the top right. After being redirected back to the home page, I am trying to get Selenium to Hover over the user info (the same place the login button was shown), and then click log out on the drop down menu.
Comment 6•6 years ago
|
||
(In reply to Benjamin Forehand Jr[:b4hand] from comment #5) > (In reply to Andreas Tolfsen ‹:ato› from comment #3) > > Can you please provide an minimal HTML document showcasing the > > problem? > > The website I am testing against is https://addons.mozilla.org. You must > login using the 'Log In' button on the top right. After being redirected > back to the home page, I am trying to get Selenium to Hover over the user > info (the same place the login button was shown), and then click log out on > the drop down menu. Do you have a more _minimal_ HTML document that reproduces it?
Reporter | ||
Comment 7•6 years ago
|
||
This is the test case I used. > from selenium.webdriver.common.action_chains import ActionChains > def test_selenium_actions(selenium): > selenium.get('file:///Users/bforehand/Projects/mozilla/bug-reports/bug-1453779/index.html') > button_1 = selenium.find_element_by_class_name('dropbtn') > button_2 = selenium.find_element_by_id('contact') > action = ActionChains(selenium) > action.move_to_element(button_1) > action.move_to_element(button_2) > action.click() > action.perform() You will have to change the URL to point to the file. I have included the file as an attachment.
Reporter | ||
Comment 8•6 years ago
|
||
This test should select the dropdown, and then try to select an element from the dropdown list.
Comment 9•6 years ago
|
||
Please note that there is a delay for opening the on hover dropdown. Your test doesn't account for that and immediately moves to the button. In such a case the dropdown is not yet visible, and this might be the reason why we fail. I wonder if pointer actions should check for element interactable. Looks like that we aren't doing that.
Reporter | ||
Comment 10•6 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #9) > Please note that there is a delay for opening the on hover dropdown. Your > test doesn't account for that and immediately moves to the button. In such a > case the dropdown is not yet visible, and this might be the reason why we > fail. I wonder if pointer actions should check for element interactable. > Looks like that we aren't doing that. Ah you are right. I also forgot to add a click to the test case. This test case passes: > from selenium.webdriver.common.action_chains import ActionChains > > > def test_selenium_actions(selenium): > selenium.get('file:///Users/bforehand/Projects/mozilla/bug-reports/bug-1453779/index.html') > button_1 = selenium.find_element_by_class_name('dropbtn') > button_2 = selenium.find_element_by_id('contact') > action = ActionChains(selenium) > action.move_to_element(button_1) > action.pause(3) > action.click(button_1) > action.move_to_element(button_2) > action.pause(3) > action.click() > action.perform()
Updated•6 years ago
|
Summary: TypeError: rect is undefined, when using Selenium Actions → TypeError: rect is undefined, when using Selenium Actions and element is not displayed.
Updated•6 years ago
|
Comment 13•4 years ago
|
||
Still up to date in 2020
Using https://github.com/SeleniumHQ/docker-selenium/releases/tag/3.141.59-zinc
v: 72.0.1
Updated•2 years ago
|
Severity: normal → S3
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•