Selenium-Remote-Driver icon indicating copy to clipboard operation
Selenium-Remote-Driver copied to clipboard

overlappingCheckDisabled capability

Open davewood opened this issue 7 years ago • 7 comments

I would like to pass an option "overlappingCheckDisabled" to the selenium driver as described here: https://github.com/SeleniumHQ/selenium/issues/1202 (scroll all the way down)

but "overlappingCheckDisabled" doesnt show up in the available capabilities documented here: https://metacpan.org/pod/Selenium::Remote::Driver#new

davewood avatar May 29 '17 10:05 davewood

the workaround, finding and clicking the button with "execute_script" doesnt work either because i get this error:

Error while executing command: executeScriptGecko: Server returned error message Unrecognized command: POST /session/40c5c9fe-2ab0-4513-b6ce-5a20110fe735/execute/sync instead of data at /home/david/perl5/perlbrew/perls/perl-5.22.2/lib/site_perl/5.22.2/Selenium/Remote/Driver.pm line 327.

davewood avatar Jun 01 '17 11:06 davewood

It looks like that's a capability that you can express when you define your desiredCapabilities. But it also looks like (from reading that first link) it's FIrefox only?

Also, unrelated, that error you got "unrecognized command" means you should either update your geckodriver & firefox to the latest, or downgrade your selenium to the previous version. Blergh, sorry about that, hmmmmm.

gempesaw avatar Jun 02 '17 15:06 gempesaw

Hey gempesaw, thanks for your feedback.

I am using the newest geckodriver 0.16.1 and yes, it's firefox only but im fine with that.

I can't seem to set the capability though or maybe i am using the wrong config format because I still get the same error message.

my $driver = Selenium::Firefox->new(
   marionette_enabled => 0,
   binary => "/home/david/dev/EPPlication/geckodriver",
   desired_capabilities => { overlappingCheckDisabled => 1 },
);

on a sidenote, there seems to be a bug in the error handler with that particular error:

2017-06-08 10:39:14 19620 Can't use string ("Element is not clickable at poin"...) as a HASH ref while "strict refs" in use at /home/david/perl5/perlbrew/perls/perl-5.22.2/lib/site_perl/5.22.2/Selenium/Remote/ErrorHandler.pm line 125.
 at /home/david/perl5/perlbrew/perls/perl-5.22.2/lib/site_perl/5.22.2/Selenium/Remote/Driver.pm line 327.

davewood avatar Jun 08 '17 08:06 davewood

Oh boy, that awful patch in geckodriver to emulate chromedriver behaviour but that is hilariously wrong when negative margins are used on the element. What fun!

Anyways, we've been disabling behaviour this for some time in our own code, I'll have to look up what we're doing; I'll paste it in here when I find it; but there might be something wrong here, as I do still have to click via javascript as a workaround in several tests.

teodesian avatar Jul 25 '17 01:07 teodesian

The thing I do most often to get around the broken overlap detection is to send the element the 'enter' key, as 99% of the time something that is clickable responds exactly the same to the enter key being sent to the element, and that hasn't yet been kneecapped.

You can also try scroll hacks, usually some combination of scrolling the window and doing get_element_location_in_view just to force it to be scrolled where it is 'clickable' will work about 75% of the time to get rid of these problems.

Probably the best way to help test authors in this module would be to have a 'method' option you can pass into click. I'd imagine it would accept parameters something like the following: 'native' -- (default) sends a click event to the element via the official webdriver click method 'keydown' -- sends the enter key to the element 'javascript' -- clicks the element by sending a click event via 'execute_script' instead of the native method.

Then folks could just 'give up and use the workaround' when they are pulling their hair out trying to figure out why something plainly visible when watching the test execute in firefox fails to send a click event to an element that is clearly visible on the page (and that if you click it in the same browser, doesn't fail).

troglodyne avatar Nov 02 '17 00:11 troglodyne

Make it so, @troglodyne

teodesian avatar Nov 02 '17 00:11 teodesian

In new geckodriver this is now the webdriverClick capability. To do this, you need but pass this to constructor:

my $d = Selenium::Remote::Driver->new( extra_capabilities => { webdriverClick => 0 }, ...)

I should probably add links to the docs as to what is supported by the drivers in that section of the POD to reduce confusion.

teodesian avatar Jan 18 '18 22:01 teodesian