Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to click on a <tr> element with multiple cells as children #1228

Open
hqbrice opened this Issue Mar 23, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@hqbrice
Copy link

hqbrice commented Mar 23, 2018

System

  • Version: 0.20
  • Platform: Windows 10 & CentOS 7
  • Firefox: 59
  • Selenium: 3.11.0

HTML Code

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Titre</title>
    </head>

    <body>
    <div>
		<table style="width: 448px;">
			<thead>
				<tr>
					<th style="width:28px"></th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<tr role="option" class="focus" id="FONCTION_1">
					<td>L1</td>
					<td>Code 1</td>
				</tr>
				<tr role="option" id="FONCTION_2">
					<td>L2</td>
					<td>Code 2</td>
				</tr>
				<tr role="option" id="FONCTION_3">
					<td>L3</td>
					<td>Code 3</td>
				</tr>
				<tr role="option" id="FONCTION_4">
					<td>L4</td>
					<td>Code 4</td>
				</tr>
			</tbody>
		</table>
			
	</div>
    </body>
</html>

JAVA Code

WebElement row = webDriver().findElement(By.id("FONCTION_1"));
row.click();

Stacktrace

org.openqa.selenium.ElementNotInteractableException: Element could not be scrolled into view
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'WS-R0-BR01', ip: '10.1.19.184', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 59.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 2616, moz:profile: C:\Users\admin\AppData\Loca..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 6.1, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, webdriver.remote.sessionid: 0f623bdf-2bbd-4a14-a87b-902...}
Session ID: 0f623bdf-2bbd-4a14-a87b-9028e4345874
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
at integration.testscase.cm.psa.TestAccesMenuPSA2.testAccesMenuPSA(TestAccesMenuPSA2.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Trace-level log

1521817862622 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"Web
DriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickEl
ement@chrome://marionette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/lis
tener.js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"}}
1521817897810 webdriver::server DEBUG -> POST /session/b3e4baec-d604-4b2d-b65c-07aba9e17b4f/element/5a4fcfc9-01c4-44fb-aa94-60345d579045/click {"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}
1521817897810 geckodriver::marionette TRACE -> 67:[0,10,"clickElement",{"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}]
1521817897802 Marionette TRACE 0 -> [0,10,"clickElement",{"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}]
1521817897816 Marionette TRACE 0 <- [1,10,{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled int ... avigate@chrome://marionette/content/listener.
js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"},null]
1521817897825 geckodriver::marionette TRACE <- [1,10,{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"WebDriverError@chrome:
//marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickElement@chrome://mari
onette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/listener.js:416:13\ncl
ickElement@chrome://marionette/content/listener.js:1224:5\n"},null]
1521817897825 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"Web
DriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickEl
ement@chrome://marionette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/lis
tener.js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"}}
1521817862622 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"Web
DriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickEl
ement@chrome://marionette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/lis
tener.js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"}}
1521817897810 webdriver::server DEBUG -> POST /session/b3e4baec-d604-4b2d-b65c-07aba9e17b4f/element/5a4fcfc9-01c4-44fb-aa94-60345d579045/click {"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}
1521817897810 geckodriver::marionette TRACE -> 67:[0,10,"clickElement",{"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}]
1521817897802 Marionette TRACE 0 -> [0,10,"clickElement",{"id":"5a4fcfc9-01c4-44fb-aa94-60345d579045"}]
1521817897816 Marionette TRACE 0 <- [1,10,{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled int ... avigate@chrome://marionette/content/listener.
js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"},null]
1521817897825 geckodriver::marionette TRACE <- [1,10,{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"WebDriverError@chrome:
//marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickElement@chrome://mari
onette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/listener.js:416:13\ncl
ickElement@chrome://marionette/content/listener.js:1224:5\n"},null]
1521817897825 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <tr id="FONCTION_1" class="focus"> could not be scrolled into view","stacktrace":"Web
DriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverClickElement@chrome://marionette/content/interaction.js:160:11\ninteraction.clickEl
ement@chrome://marionette/content/interaction.js:131:11\nclickElement/<@chrome://marionette/content/listener.js:1225:14\nnavigate/<@chrome://marionette/content/listener.js:417:13\nnavigate@chrome://marionette/content/lis
tener.js:416:13\nclickElement@chrome://marionette/content/listener.js:1224:5\n"}}

@jmcook74

This comment has been minimized.

Copy link

jmcook74 commented Mar 23, 2018

Does this work if you click on either TD element?

@hqbrice

This comment has been minimized.

Copy link
Author

hqbrice commented Mar 23, 2018

Yes it is. But I need to click on tr element for compatibility and in my case some td elements are not visible. In waiting fixing I loop on td while an exception is thrown

@jmcook74

This comment has been minimized.

Copy link

jmcook74 commented Mar 23, 2018

I was wondering if it was a similar issue to mine, but it's not. I hope you find a resolution fast.
My issue is the page is wrapping my last TD to the next line. The driver thinks the element is not on the screen. I get the same exception. I should probably create a ticket.

@hqbrice

This comment has been minimized.

Copy link
Author

hqbrice commented Mar 23, 2018

Effectively your problem is not the same. Thanks

@whimboo whimboo changed the title Unable to clix on a tr tag Unable to click on a tr tag Mar 26, 2018

@whimboo

This comment has been minimized.

Copy link
Collaborator

whimboo commented Mar 26, 2018

Basically the underlying issue is Firefox related and tracked as https://bugzilla.mozilla.org/show_bug.cgi?id=1413493. In https://bugzilla.mozilla.org/show_bug.cgi?id=1406505 I added a workaround for that by letting Marionette default to the first contained cell. I wonder why this is not working here.

@hqbrice

This comment has been minimized.

Copy link
Author

hqbrice commented Mar 26, 2018

OK. What do you need to understand why this is not working here ?

@whimboo

This comment has been minimized.

Copy link
Collaborator

whimboo commented Mar 26, 2018

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1448825 for that. Thanks for reporting.

@whimboo whimboo added the marionette label Mar 26, 2018

@whimboo whimboo changed the title Unable to click on a tr tag Unable to click on a <tr> element with multiple cells as children Mar 26, 2018

twalpole added a commit to teamcapybara/capybara that referenced this issue Jun 6, 2018

twalpole added a commit to teamcapybara/capybara that referenced this issue Jun 6, 2018

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 23, 2018

taca
www/ruby-capybara: update to 3.8.0
# Version 3.8.0
Release date: 2018-09-20

### Added

* Workaround gecodriver 0.22 issue with undefined pause durations
* :element selector ignores XML namespaces

### Fixed

* Added Errno::ECONNRESET to the errors which will allows https server detection

# Version 3.7.2
Release date: 2018-09-12

### Fixed

* Fix MatchQuery based matchers when used on a root element found using any type of parent/ancestor query - Issue #2097

* Fix Chrome/FF HTML5 drag simulation for elements (a, img) which default to draggable - Issue #2098

# Version 3.7.1
Release date: 2018-09-05

### Fixed

* Restored ability to pass symbol as the CSS selector when calling `has_css?`/`have_css`/etc - Issue #2093

# Version 3.7.0
Release date: 2018-09-02

### Added

* `Capybara.disable_animation` can be set to a CSS selector to identify which elements will have animation disabled [Michael Glass]
* `Capybara.default_normalize_ws` option which sets whether or not text predicates and matchers (`has_text?`, `has_content?`, `assert_text`, etc) use `normalize_ws` option by default. Defaults to false. [Stegalin Ivan]
* Selector based predicates, matchers, and finders now support the `:normalize_ws` option for the `:text`/`:exact_text` filters. Defaults to the `Capybara.default_normalize_ws`setting above.
* Element `choose`/`check`/`uncheck`/`attach_file`/`fill_in` can now operate on the element they're called on or a descendant if no locator is passed.

### Fixed

* All CSS styles applied by the `Element#attach_file` `:make_visible` option will now have `!important` priority set to ensure they override any other specified style.
* Firefox file inputs are only manually cleared when necessary.

# Version 3.6.0
Release date: 2018-08-14

### Added

* Workaround geckodriver/firefox send_keys issues as much as possible using the Selenium actions API
* Workaround lack of HTML5 native drag and drop events when using Selenium driver with Chrome and FF >= 62
* `Capybara.predicates_wait` option which sets whether or not Capybaras matcher predicate methods (`has_css?`, `has_selector?`, `has_text?`, etc.) default to using waiting/retrying behavior (defaults to true)

# Version 3.5.1
Release date: 2018-08-03

### Fixed

* Fixed misspelled method name `refute_matches_elector` => `refute_matches_selector`

# Version 3.5.0
Release date: 2018-08-01

### Added

* text predicates and matchers (`has_text?`, `has_content?`, `assert_text`, etc) now support a `normalize_ws` option

### Fixed

* `attach_file` with Selenium and local Firefox 62+ now correctly generates only one change event when attaching multiple files

# Version 3.4.2
Release date: 2018-07-24

### Fixed

* `match_xxx` selectors and `matches_xxx?` predicates work correctly with elements found using a sibling selector - Issue #2073

# Version 3.4.1
Release date: 2018-07-20

### Fixed

* `Session#evaluate_script` now strips the script in `Session` rather than only in the Selenium driver

# Version 3.4.0
Release date: 2018-07-19

### Fixed

* Make selenium driver :backspace clear stategy work even if caret location is in middle of field content [Champier Cyril]
* Selenium issue with fieldset nested in disabled fieldset not being considered disabled
* `Session#evaluate_script` and `Element#evaluate_script` now strip leading/trailing whitespace from scripts [Ian Lesperance]

### Added

* Work around Selenium lack of support for `file_detector` with remote geckodriver
* `#within_frame` locator is optional when only one frame exists
* `Capybara.test_id` option that allows for matching the Capybara provided selector types on an arbitrary attribute
  (defaults to nil), set to your test id attribute ('data-test-id, etc) if using test id attributes in your project

# Version 3.3.1
Release date: 2018-06-27

### Fixed

* `selenium-webdriver` version check [ahorek]
* Selenium driver correctly responds to `disabled?` for fieldset elements - Issue #2059 [Thomas Walpole]

# Version 3.3.0
Release date: 2018-06-25

### Added

* RackTest driver now handles 307/308 redirects
* `execute_async_script` can now be called on elements to run the JS in the context of the element
* `:download` filter option on `:link' selector
* `Window#fullscreen`
* `Element#style` and associated matchers

### Changed

* Minimum "supported" `selenium-webdriver` is raised to 3.5.0 (but you really should be using newer than that)

### Fixes

* Selenium driver with Firefox workaround for clicking on table row - mozilla/geckodriver#1228
* :class and :id filters applied to CSS based selectors now correctly handle the CSS comma
* Selenium driver handles namespaces when generating an elements `#path` - Issue #2048

# Version 3.2.1
Release date: 2018-06-04

### Fixes

* Only split CSS selectors when :class or :id options are given. Restores 3.1.1 functionality for now but the underlying issue
  will require a larger fix, hopefully coming soon. - Issue #2044 [Thomas Walpole]

# Version 3.2.0
Release date: 2018-06-01

### Changed

* Ruby 2.3.0+ is now required
* `ElementNotFound` errors raised in selector filters are interpreted as non-matches

### Added

* New global configuration `default_set_options` used in `Capybara::Node::Element#set` as default `options` hash [Champier Cyril]
* `execute_script` and `evaluate_script` can now be called on elements to run the JS in the context of the element [Thomas Walpole]
* Filters in custom selectors now support a `matcher` Regexp to handle multiple filter options [Thomas Walpole]
* `:element` selector type which will match on any attribute (other than the reserved names) passed as a filter option [Thomas Walpole]
* `:class` filter option now supports preceding class names with `!` to indicate not having that class [Thomas Walpole]
* `:class` and `:id` filter options now accept `XPath::Expression` objects to allow for more flexibility in matching [Thomas Walpole]
* `Capybara.disable_animation` setting which triggers loading of a middleware that attempts to disable animations in pages.
  This is very much a beta feature and may change/disappear in the future. [Thomas Walpole]

# Version 3.1.1
Release date: 2018-05-25

### Fixes

* Ensure keystrokes are sent when setting time/date fields to a string with the Selenium driver [Thomas Walpole]

# Version 3.1.0
Release date: 2018-05-10

### Added

* Support for using `select` with text inputs associated with a datalist element
* `type` filter on `:button` selector
* Support for server operating in https mode
* Selenium driver now uses JS to fill_in/set date and time fields when passed date or time objects [Aleksei Gusev, Thomas Walpole]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.