SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

2.9 regression: Invalid MoveTargetOutOfBoundsError #2700

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 2700

The attached script reproduces the problem. See also the comment on r14271.

Reported by jari.bakken on 2011-10-23 00:27:29


lukeis commented 8 years ago
The error message is:

  Requested location (909, 12) is outside the bounds of the document (820, 843) (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)

Reported by jari.bakken on 2011-10-23 00:33:21

lukeis commented 8 years ago
Thanks for the test case.

Reported by simon.m.stewart on 2011-10-23 01:09:28

lukeis commented 8 years ago
This issue was closed by revision r14337.

Reported by simon.m.stewart on 2011-10-23 01:44:43

lukeis commented 8 years ago
Thanks!

Reported by jari.bakken on 2011-10-23 10:24:43

lukeis commented 8 years ago
Any estimate as to when these changes will be present in a stable tag of WebDriver?
Trying to move my system-tests from 1.0 to 2.0, but the MoveTargetOutOfBoundsError
is currently impeding that process.

Reported by emery.coxe@acquia.com on 2011-10-26 21:09:24

lukeis commented 8 years ago
We're planning to release 2.10 some time this week. 2.8 should work ok until then. 

Reported by jari.bakken on 2011-10-26 21:48:40

lukeis commented 8 years ago
The easiset way to avoid it is to have a custom firefox profile where it is maximized.
Of course it will only works it the Element fits in the maximized screen.

Reported by pisaruk on 2011-10-27 12:30:43

lukeis commented 8 years ago
Thanks guys. That latter solution will solve my issue in some cases; the new release,
however, is what I'm really looking forward to!

Thanks again!

Reported by emery.coxe@acquia.com on 2011-10-27 18:09:34

lukeis commented 8 years ago
I have updated to selenium 2.10.0 and i'm getting MoveTargetOutOfBoundsError on steps
that work on 2.8 and 2.9

Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Given coordinates
(551, 961.5) are outside the document. Error: [MoveTargetOutOfBoundsError] The target
location (551, 961) is not on the webpage.
Build info: version: '2.10.0', revision: '14416', time: '2011-10-27 23:00:15'

Reported by castilho.rs on 2011-10-28 16:27:23

lukeis commented 8 years ago
@9: Can you provide a test case?

Reported by jari.bakken on 2011-10-28 16:44:33

lukeis commented 8 years ago
I'm also getting a similar error with 2.10.0:

    Requested location (367, 567) is outside the bounds of the document (undefined,
undefined) (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)

Reported by john.firebaugh on 2011-10-28 19:02:05

lukeis commented 8 years ago
None of these reports is actionable without a reproducible test case (which should include
the code *and* sample page to run the code against).

Reported by eran.mes on 2011-10-28 20:30:36

lukeis commented 8 years ago
Same problem, using 2.10.0

     Failure/Error: click_link 'mais um produto'
     Selenium::WebDriver::Error::MoveTargetOutOfBoundsError:
       Requested location (270, 774) is outside the bounds of the document (undefined,
undefined)

Reported by timotta on 2011-11-02 04:23:32

lukeis commented 8 years ago
it happens when its necessary scroll the window to view the link

Reported by timotta on 2011-11-02 04:24:43

lukeis commented 8 years ago
A quick explanation: This functionality is tested in WebDriver's internal tests suite.
Without an accurate description of the state where this functionality does not work
as expected, we cannot debug the issue. The test suite includes cases where scrolling
happens. So telling us that this functionality does not work for you when it's necessary
to scroll the window is not enough.
The only way to get a fix for your use case is to describe your use case accurately
- actual code, actual html where this fails.

Reported by eran.mes on 2011-11-02 04:37:30

lukeis commented 8 years ago
This is probably duplicated by issue 2708 . Please see that issue for an attachment
which demonstrates the problem.

Reported by robert.munteanu on 2011-11-02 08:34:07

lukeis commented 8 years ago
Issue 2708 has been merged into this issue.

Reported by jari.bakken on 2011-11-02 10:55:30

lukeis commented 8 years ago
The code provided in issue 2708 passes for me on OS X - haven't tried on Linux which
is the reporter's platform:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.example.selenium.ExtGridTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 12.832 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Reported by jari.bakken on 2011-11-02 11:01:25

lukeis commented 8 years ago
Here's an updated test, which sets native events to false. I've verified that the test
works on Windows XP with native events, but not with synthentic events.

I am unable to test on Linux with native events as the browser launch hangs - but that's
a different issue altogether which doesn't bother me too much.

Reported by robert.munteanu on 2011-11-02 11:29:11


lukeis commented 8 years ago

Reported by dawagner on 2011-11-03 03:13:08

lukeis commented 8 years ago
@dawagner were you able to reproduce this?

Reported by jari.bakken on 2011-11-04 17:00:15

lukeis commented 8 years ago
Haven't tried, but didn't want the bug to get lost because it's closed

Reported by dawagner on 2011-11-04 18:24:59

lukeis commented 8 years ago
Issue on 2.11 Selenium, run java: xubuntu 11.10, FireFox 7.0.1. When click on a button.
Button placed in a scrollable div, and form is longer than height of the window (1200
pixel).

Reported by istvan.pato on 2011-11-06 22:06:12

lukeis commented 8 years ago
@23: Instead of describing the HTML needed to reproduce the problem, could you please
attach a sample page?

Reported by jari.bakken on 2011-11-06 23:51:01

lukeis commented 8 years ago
Here is page example. Error happens when I tring to open request with click element
by link text (8th column, "№") somewhere in the end of the list.
Error happens only whent I'm running tests from Linux machine, with running from Windows
7 x86 machine test works fine

   [testng] FAIL: Requested location (448, 4096) is outside the bounds of the document
(undefined, undefined); duration or timeout: 47 milliseconds
   [testng] Build info: version: '2.11.0', revision: '14431', time: '2011-10-28 16:27:42'
   [testng] System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2',
java.version: '1.7.0'
   [testng] Driver info: driver.version: RemoteWebDriver; duration or timeout: 566
milliseconds
   [testng] Build info: version: '2.11.0', revision: '14431', time: '2011-10-28 16:27:42'
   [testng] System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-bpo.5-686',
java.version: '1.6.0_26'
   [testng] Driver info: driver.version: LoggingWebDriver)

Reported by netmans.mailbox on 2011-11-07 05:35:49


lukeis commented 8 years ago
Thanks. The attached page in comment 25 + this script reproduces the (undefined, undefined)
problem on OS X for me:

  https://gist.github.com/1dc20a801cee6d00d6be

Reported by jari.bakken on 2011-11-07 13:56:08

lukeis commented 8 years ago
We had this problem on a new build box we were putting together; We found the bug was
somehow related to screen resolution.

We'd get this error when we had the screen resolution set to 1600x1200.  When we switched
to 1280x1024, this problem went away.

We're using OS X 10.7.2, and we saw the problem both with Firefox 7 and 3.6.12, so
it didn't seem browser dependent.

Reported by sellis@pivotalsf.com on 2011-11-09 17:31:49

lukeis commented 8 years ago
Issue 2714 has been merged into this issue.

Reported by jari.bakken on 2011-11-13 12:10:50

lukeis commented 8 years ago
A failing test for this bug was added in r14576.

Reported by jari.bakken on 2011-11-13 12:17:34

lukeis commented 8 years ago
In 2.12.0 I could help myself by maximizing the screen:

int width = Integer.parseInt(selenium.getEval("screen.width;"));
int height = Integer.parseInt(selenium.getEval("screen.height;"));
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().window().setSize(new Dimension(width,height));

Scrolling did not work using getEval or executeScript with FF7 on Ubuntu.

Reported by volker.krebs on 2011-11-17 14:01:25

lukeis commented 8 years ago
Is there a workaround for this? I've tried scrolling the offending button (in my case)
into visibility, but that doesn't seem to help.

Reported by mhaecker on 2011-11-17 15:05:22

lukeis commented 8 years ago
Yes, I tried scrolling the element into visibility too, didn't help.  What worked for
me was using the JavascriptExecutor:

JavascriptExecutor js = (JavascriptExecutor) firefox;
js.executeScript( "document.getElementById('id-of-element-here').click();" );

I was able to click a button that previously failed with a TargetOutOfBoundsError.

Reported by mclean.bryce on 2011-11-17 18:05:06

lukeis commented 8 years ago
@mclean.bryce

After struggling with this for >2 weeks, I have accepted defeat and implemented your
method.

I tried emulating the JS that checks document bounds (utilized by WebDriver), which
worked for me approximately 50% of the time.

Unfortunately, the elements I've been working with are in a JCarousel, and occasionally,
the element would report itself "in document bounds", only to 'move out of bounds'
before the click. I added many robustness measures to counteract this. Still, the non-determinacy
of this bug has forced me to accept this JS hack.

WebDriver folks: perhaps you could make public a method to check document bounds? It
is in the public repo (although you have to dig), and it is possible to emulate (with
95% accuracy). Yet it would provide at least some solution to this bug. As it stands,
it doesn't seem that the 'MoveTargetOutOfBounds' error will be removed. And I don't
think that's a bad thing, either. An easy (or at least, feasible) workaround wouldn't
be a bad thing either.

Reported by emery.coxe@acquia.com on 2011-11-17 20:46:50

lukeis commented 8 years ago
We're also being bitten by this. Could anybody point me to some information about the
idea behind this change? I've searched but can't find an announcement or explanation
about this change of behavior.

Is there any way to scroll with webdriver? Can't seem to find it in the API? If not,
what would be the officially supported way to click a link that's at the bottom in
a div with scrollbars?

Reported by thijs@80beans.com on 2011-11-19 12:40:06

lukeis commented 8 years ago
I've added a test case that reproduces the issue for me (OSX Lion 10.7.1, Firefox 8.0,
selenium-webdriver 2.13.0)

Reported by mhaecker on 2011-11-21 21:32:46


lukeis commented 8 years ago
@mhaecker: Thanks. That's the same case we already have in our test suite - see comment
30.

Reported by jari.bakken on 2011-11-21 21:37:07

lukeis commented 8 years ago
@jari.bakken: Uhm, but wasn't that fix checked in some version ago? I though that was
already deployed?

Reported by mhaecker on 2011-11-22 08:44:21

lukeis commented 8 years ago
No, I just added the failing (and ignored) test. AFAIK Eran and Daniel is working on
the actual fix, for native and synthesized events respectively. 

Reported by jari.bakken on 2011-11-22 10:42:22

lukeis commented 8 years ago
How is this only priority medium?  This breaks the most basic feature for any selenium
test, clicking on an element on the page.  Is there any update for this issue?

Reported by sean.r.stephenson on 2011-11-23 19:36:42

lukeis commented 8 years ago
I would also like to request that this becomes priority high as it breaks firefox for
almost all test suites that use clicking on elements. (i.e. I would guess most of them.

You do have to use some css that introduces overflow: auto or some such, but that is
a pretty common element on websites today.

Regards,
Martin

Reported by mhaecker on 2011-11-24 07:23:33

lukeis commented 8 years ago
This is also a high priority issue for me when trying to click a button outside the
screen scope.

The exception I get is:
org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: Requested location
(76, 909) is outside the bounds of the document (800, 876); duration or timeout: 26
milliseconds
Build info: version: '14666', revision: 'unknown', time: '2011-11-10 19:22:03'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8', java.version:
'1.6.0_26'
Driver info: driver.version: RemoteWebDriver

Reported by laura.vendramini@arclight.com.au on 2011-11-24 23:28:12

lukeis commented 8 years ago
+ for high priority from me as well.

I still have to use Selenium in v. 2.8.0 and from yesterday fight with Ubuntu who is
trying to upgrade my Firefox to 8.0 ;-)

Reported by szura.g on 2011-11-25 15:12:30

lukeis commented 8 years ago
High priority for me too.. still stuck with 2.8.0

Reported by castilho.rs on 2011-11-25 15:39:58

lukeis commented 8 years ago
A quick update: Daniel and I have been working to make the FirefoxDriver scroll less.
We will also modify it to  throw the MoveTargetOutOfBounds when the coordinates outside
of the document's bounds.
The fix is targeted towards to the 2.15 release.

Reported by eran.mes on 2011-11-25 15:42:55

lukeis commented 8 years ago
Thanks a lot for the update and working on the fix. That is great to hear.  We are using
the remote driver with firefox as the browser and getting this problem.  Will the fix
you are talking about also work with the remote driver driving firefox?  Thanks again.

Reported by jjrussell on 2011-11-26 14:26:05

lukeis commented 8 years ago
@46: Yes, it will also work with the remote driver.

Reported by jari.bakken on 2011-11-26 14:27:26

lukeis commented 8 years ago
@47 / @jari.bakken:

1) I agree with others that this is high priority. It is not desirable to be stuck
on 2.8 or below. I just migrated a massive testing suite from Selenium 1.0 to Webdriver;
it would be desirable to stay on the current build. I currently am on the current build,
but have had to add significant amounts of work to get around this issue.

2) I don't necessarily think that it is a bad thing that you cannot click an element
out of document bounds (you can always use jQuery or plain vanilla JS to do it if you
really want). However, if this is to be part of the functionality, we need a way to
check the location of an element against the document bounds. This is currently not
possible, and it has not been addressed. Without this functionality, developers will
non-deterministically experience failures related to this issue.

Reported by emery.coxe@acquia.com on 2011-12-01 16:12:57

lukeis commented 8 years ago
Could someone point me to the explanation of the feature behind this exception? (Reading
through this thread doesn't seem to enlighten me what to search for).

Reported by mhaecker on 2011-12-02 09:04:22

lukeis commented 8 years ago
@49

In Selenium 1.0 and in Webdriver prior to tag 2.9.0, calling the 'Element#click' method
could be done for any element in the DOM (in 1.0, you could do it an _any_ element,
for 2.0+, you can only click on visible - or displayed - elements...I am unsure as
to whether that has always been the case in Webdriver, or whether at some point in
time you could click an arbitrary element).

At the 2.9.0 revision, Webdriver added an error 'MoveTargetOutOfBounds' error, which
is thrown whenever the desired element is outside of the document bounds. This broke
many peoples tests.

There are valid reasons for both sides of the argument. For instance, in Firefox 5.0+,
the 'click()' function is defined for any element in the DOM (and further, you can
click elements via jQuery as well); so despite this 'error', you can technically bypass
it by executing an arbitrary JS script through Webdriver that clicks the element. For
elements with complicated expressions, this can be a tad tricky. Further, it raises
the question: what are we trying to accomplish with this testing tool? It seems that
Webdriver is moving towards emulating _precisely_ the functionality that an end user
has capable to them. That is all well and good, but there are certainly use cases where
we simply need to access an element via clicking, and it is not necessarily relevant
the element be within the page bounds. Further, there is no standard way to check the
document bounds against the location of an element (it can be done, and in doing so,
I unearthed some interesting behavior in webdriver - http://code.google.com/p/selenium/issues/detail?id=2984).

To offer the counterpoint that I presume underlies the decision to add this error,
I will reiterate: from my personal, uninformed perspective, it appears that Webdriver
desires to emulate, as best as possible, the actions of an end user on a given site,
and aims to allow exactly the interactions that an end user would have on a given site.

Reported by emery.coxe@acquia.com on 2011-12-02 17:55:19

lukeis commented 8 years ago
Why don't you add an option to switch between the two behaviors ?

The new and stricter behavior should be the default one, as it emulates a "real" user,
and it's the goal Selenium is trying to reach.

But for the legacy tests that are broken by the 'MoveTargetOutOfBounds' error, it would
be great to be able to revert to the old behavior.

Reported by clement.denis on 2011-12-02 18:07:48