selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Selenium clicks below elements when running on Apple Mac/Safari 13.0.1

Open RonKalian opened this issue 7 years ago • 38 comments

🐛 Bug Report

When Selenium tests that click on elements are run, the clicking is visibly below the actual element. This happens for all elements tested and for all tests on which we tried this.

It only happens on Apple Mac/Safari 13.0.1. Was not tested on iOS devices. Same Apple Mac machine runs tests correctly on Chrome. Other Macs running Safari 12.x also run correctly. We tested this with Selenium 3.141.59 and 4.0.0 alpha-2 - bug reproduces identically on both versions, when browser is Safari 13.0.1.

To Reproduce

Detailed steps to reproduce the behavior:

  1. Use any Selenium test that involves clicking an element (button, etc) that is sufficiently narrow.
  2. Run on Apple Mac, Safari v13.0.1. selenium-standalone-server.jar v3.141.59 or v4.0.0 alpha-2.
  3. Clicking will visibly occur below the element. All clicking seems to be off expected location by a constant offset.

Expected behavior

When clicking an element, clicking should occur within that element, such that it is clicked.

Test script or set of commands reproducing this issue

Environment

OS: Browser: Safari Browser version: 13.0.1 (14608.2.11.1.11) Browser Driver version: safaridriver 'Included with Safari 13.0.1' (same version as browser) Selenium Grid version (if applicable): N/A

RonKalian avatar Oct 04 '19 17:10 RonKalian

Hi Ron,

We are also witnessing something similar. We have found some issues with extracting text from labels and that's also not working as expected.

Thanks, Ash

asharma84 avatar Oct 04 '19 19:10 asharma84

Yes, we know already that Safari 13 fails ~20% of the regression test suite that Safari 12 passed well. I'll merge into this issue all the complains related to Safari 13 blackout.

barancev avatar Oct 05 '19 19:10 barancev

Hi @barancev

Who will be fixing these issues? Apple Safari team or the Selenium devs/contributors?

Thanks, Ash

asharma84 avatar Oct 05 '19 20:10 asharma84

It should be fixed by Apple.

barancev avatar Oct 05 '19 20:10 barancev

Thank you everybody for your replies. Any information about which Apple components specifically may be at fault, and links to issues you raised with Apple would be much appreciated :)

RonKalian avatar Oct 07 '19 09:10 RonKalian

safaridriver maintainer here.

Please include the operating system version on which you are seeing these results. As far as I know, the only reports I've seen are from Mojave users who upgraded to Safari 13. Haven't seen any reports on Catalina yet.

burg avatar Oct 09 '19 19:10 burg

Hi @burg ,

I can confirm that its happening on Mojave for me. But I guess safari got updated with the OS and that's why it's happening.

-Ash

asharma84 avatar Oct 09 '19 19:10 asharma84

@burg I am experiencing this issue on Mojave 10.14.6 as well. Clicking buttons was working with Safari version 13.0. When I upgraded to 13.0.1 it stopped working. The issue persists with Safari 13.0.2.

rmedina6 avatar Oct 10 '19 12:10 rmedina6

Hi @burg I am experiencing this issue on Catalina with Safari 13.0.2

jetjuan avatar Oct 10 '19 18:10 jetjuan

Does there is any work around to solve this issue ??

Revathi2910 avatar Oct 15 '19 10:10 Revathi2910

I note that there is little movement on the 2 related WebKit issues (see links below). This is a blocking defect for Selenium/Appium on MacOS/iOS and the community needs a fix or workaround ASAP. Even if WebKit/Apple take their time with a fix, perhaps adjust x,y location of click (x is correct, y needs adjustment) in Selenium/Appium such that it works until WebKit/Apple have fixed it?
https://bugs.webkit.org/show_bug.cgi?id=202589 https://bugs.webkit.org/show_bug.cgi?id=202802

RonKalian avatar Oct 15 '19 10:10 RonKalian

Just tested with STP 94 - defect still reproduces. Are there any plans to fix this or provide a workaround?

RonKalian avatar Oct 29 '19 11:10 RonKalian

It is being investigated.

On Oct 29, 2019, at 04:33, Ron [email protected] wrote:

 Just tested with STP 94 - defect still reproduces. Are there any plans to fix this or provide a workaround?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

burg avatar Oct 29 '19 14:10 burg

@burg Kindly let us know if there is any update?

I am using macOS 10.14.6 My Safari got updated to 13.0.2

There are a few Web Applications that are working fine. But in a few Web Applications (like salesforce) I am facing major issues. Sometimes Selenium has issues in finding an element also.

climbwithme avatar Nov 20 '19 05:11 climbwithme

This issue still reproduces on Safari Technology Preview (STP) release 96.

RonKalian avatar Nov 22 '19 12:11 RonKalian

It is being investigated. … On Oct 29, 2019, at 04:33, Ron @.***> wrote:  Just tested with STP 94 - defect still reproduces. Are there any plans to fix this or provide a workaround? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi @burg

One observation. SafariDriver is not able to interact with an element which has a custom HTML tag in it's hierarchy. Can you kindly advise why this might be the case? Is it a known issue in SafariDriver?

climbwithme avatar Nov 27 '19 08:11 climbwithme

webdriver.executeScript('arguments[0].click();', elem);

This is what I started doing. However, if someone has the time to figure this out, a nicer workaround might be to find some way to automatically translate clicks to "executeScript" calls. The idea is to do something like this but the main problem is figuring out how to translate the parameters for a "clickElement" command to an equivalent "executeScript":

new SafariDriver() {
    @Override
    protected Response execute(String driverCommand, Map<String, ?> parameters) {
        if (DriverCommand.CLICK_ELEMENT.equals(driverCommand)) {
            // return super.executeScript(...)
        }
        return super.execute(driverCommand, parameters);
    }
}

benken-parasoft avatar Dec 05 '19 20:12 benken-parasoft

We actually wrote it into the click function in our node package that wraps selenium. https://www.npmjs.com/package/dce-selenium

nataliemona avatar Dec 05 '19 21:12 nataliemona

This is still being investigated. A fix that was expected for STP 96 was not included for various reasons. I'm sorry for the trouble and will ping All The Threads when it's really fixed.

burg avatar Dec 06 '19 18:12 burg