Bug 202589 - Unable to Click on Safari 13
Summary: Unable to Click on Safari 13
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: Other
Hardware: All All
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-04 10:36 PDT by Kushang
Modified: 2020-03-20 09:27 PDT (History)
28 users (show)

See Also:


Attachments
Issue Reproducible (180.19 KB, image/png)
2019-11-22 12:56 PST, Vikrant Kumar Chauhan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kushang 2019-10-04 10:36:36 PDT
Selenium tests are broken with the Safari 13 release. Webdriver/SafariDriver is Unable to click on buttons on the page.
Comment 1 Radar WebKit Bug Importer 2019-10-04 14:51:01 PDT
<rdar://problem/55995991>
Comment 2 Brian Burg 2019-10-08 08:18:01 PDT
(In reply to Kushang from comment #0)
> Selenium tests are broken with the Safari 13 release. Webdriver/SafariDriver
> is Unable to click on buttons on the page.

Please include more details, such as your system, version of Selenium, and what tests are failing.
Comment 3 Hai Lee 2019-10-09 21:20:43 PDT
The click action seems to be performed, but nothing happens. My logs show that the element (which is a link) is clicked, but the redirection of page does not occurs.
Selenium version: 3.141.59
Safari version: both 13.0.1 and STP 93
Comment 4 gerald.ehmayer 2019-10-10 01:28:40 PDT
The click issue still occurs with Safari 13.0.2 on latest macOS 10.15 release.
Comment 5 gerald.ehmayer 2019-10-10 01:36:17 PDT
Can be reproduced with this Java snippet:

driver.get("https://the-internet.herokuapp.com/add_remove_elements/");
assert driver.findElementsByCssSelector(".added-manually").size() == 0;
WebElement button = driver.findElementByCssSelector(".example > button:nth-child(1)");
button.click(); // issue: nothing happens
assert driver.findElementsByCssSelector(".added-manually").size() == 1;
Comment 6 Mark 2019-10-10 01:46:37 PDT
In my testing, it clicks at an offset from where it should be clicking... It clicks slightly below where it is meant to click, so in our case it ends up clicking the button below the one we wanted...
Comment 7 alex.anich 2019-10-10 16:06:38 PDT
I think that these two issues are related:

https://bugs.webkit.org/show_bug.cgi?id=202802

A common thread between the broken buttons is an :active psuedo class.
Comment 8 Liam 2019-10-21 14:44:56 PDT
Same issue for me. When is this likely to be fixed? Thanks
Comment 9 Mark 2019-10-29 05:08:23 PDT
Issue still persists in latest Safari Technology preview. When will this be fixed? Are we expected to not bother testing on Safari 13 any more? I can imagine this will lead to a lot of buggy applications in Safari 13 if nobody can do automated testing with it...
Comment 10 Brian Burg 2019-11-01 12:56:45 PDT
This bug is being actively investigated.
Comment 11 Brian Burg 2019-11-01 12:57:52 PDT
(In reply to alex.anich from comment #7)
> I think that these two issues are related:
> 
> https://bugs.webkit.org/show_bug.cgi?id=202802
> 
> A common thread between the broken buttons is an :active psuedo class.

I don't think they are related. This bug is about a regression in safaridriver and its WebKit parts.
Comment 12 Brian Burg 2019-11-01 14:52:25 PDT
<rdar://problem/56014369>
Comment 13 Vikrant Kumar Chauhan 2019-11-07 11:53:17 PST
I am still facing this issue with STP 93. Please fix it.

Thanks.
Comment 14 Ron Kalian 2019-11-08 03:00:51 PST
(In reply to Vikrant Kumar Chauhan from comment #13)
> I am still facing this issue with STP 93. Please fix it.
> 
> Thanks.

Same here, reproduced issue on STP 95.
Comment 15 boaz 2019-11-11 05:13:58 PST
I am experiencing the same problem with Safari version 13.0.3 (15608.3.10.1.4).
The page I load has a clickable button.
I am using Python + Selenium + latest Safaridriver.
The element is discovered but when I issue a .click() command, nothing happens.
The same works fine on FireFox and Chrome.
Also, running document.getElementById('element_id').click() on the javaScript console, works. 
Can someone let know if there is any progress with this issue?

Thanks
Comment 16 Dave Arrowsmith 2019-11-14 01:41:05 PST
Preventing me from running Selenium tests on Safari. Works fine on Chrome, Firefox and (on another machine) Safari 12.

Mac Mini A1993
OSX 10.14.6
Safari 13.0.3 14608.3.10.10.1
Selenium 3.141.59
Comment 17 jeremy.cattau 2019-11-14 09:05:51 PST
Adding my comment in here as experiencing the same thing.
Comment 18 matthew-renshaw 2019-11-15 01:36:22 PST
I picked an unfortunate time to configure our automated test suite to run in safari for the first time; I'm also encountering this issue.
- C# Selenium bindings (v3.141.0) 
- Safari (13.0.3)
Comment 19 Brian Burg 2019-11-15 19:09:42 PST
We expect this issue to be fixed in Safari Technology Preview 96.
Comment 20 Chandresh Parmar 2019-11-20 01:42:58 PST
Hi,

I am also facing an issue with click action when using xpath and I think it is similar to this one. 

Using XPATH to click on element, clicks somewhere else instead of given element. However; if I use id of that element, then it works fine.

I have to use xpath instead of id as the id is generated dynamically.

driver.findElement(By.xpath("//img[@id=’Add’]").click(); - Not working, click on top or below of element
driver.findElement(By.id(“a0214”).click(); - Working, click on proper element

Is this similar to this? If not, can you please suggest what I am missing here?

Thanks,
Chandresh Parmar
Comment 21 Jimmy Collazos 2019-11-22 02:43:03 PST
I have the same problem, but in my case is when the element is in shadow-dom

Idea:
=======
The element exist; but the service can't find and then execute "Window.getComputedStyle" with null, undefined or similar


Safaridrier Version:
====================
"included with Safari 13.0.3 (14608.3.10.10.1)"


Reproduce Requests:
===================
[POST] http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element
-> DATA { using: 'css selector', value: 'shop-app' }
-> RESULT { 'element-6066-11e4-a52e-4f735466cecf': 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' }

[POST] http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/execute/sync
-> DATA { 
  script: 'return (function (elem) {return (function() {if (this.shadowRoot) {return this.shadowRoot.querySelector(\'shop-home\')}return this.querySelector(\'shop-home\')}).call(elem);}).apply(null, arguments)',  
  args:   [ { 'element-6066-11e4-a52e-4f735466cecf': 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C', ELEMENT: 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' } ] 
}
-> RESULT { 'element-6066-11e4-a52e-4f735466cecf': 'node-5D1721C6-39B1-425E-8751-2DF193491171' }

[POST] http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element/node-5D1721C6-39B1-425E-8751-2DF193491171/click
->ERROR-RESULT: A JavaScript exception occured: Argument 1 ('element') to Window.getComputedStyle must be an instance of Element
Comment 22 Ron Kalian 2019-11-22 04:08:22 PST
This issue still reproduces on Safari Technology Preview (STP) release 96.
Comment 23 Vikrant Kumar Chauhan 2019-11-22 12:56:37 PST
Created attachment 384186 [details]
Issue Reproducible

STILL REPRODUCIBLE with STP 96.

I've tested this issue with STP 96 and found it as still reproducible.
Comment 24 Mark 2019-11-24 11:38:13 PST
We also tested it and can still reproduce it in STP 96... So it looks like it has not been fixed.
Comment 25 Natalie 2019-12-02 12:13:39 PST
I have also reproduced the bug in STP 96.
Comment 26 arian.ics 2019-12-17 23:02:18 PST
(In reply to Jimmy Collazos from comment #21)
> I have the same problem, but in my case is when the element is in shadow-dom
> 
> Idea:
> =======
> The element exist; but the service can't find and then execute
> "Window.getComputedStyle" with null, undefined or similar
> 
> 
> Safaridrier Version:
> ====================
> "included with Safari 13.0.3 (14608.3.10.10.1)"
> 
> 
> Reproduce Requests:
> ===================
> [POST]
> http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element
> -> DATA { using: 'css selector', value: 'shop-app' }
> -> RESULT { 'element-6066-11e4-a52e-4f735466cecf':
> 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' }
> 
> [POST]
> http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/execute/
> sync
> -> DATA { 
>   script: 'return (function (elem) {return (function() {if (this.shadowRoot)
> {return this.shadowRoot.querySelector(\'shop-home\')}return
> this.querySelector(\'shop-home\')}).call(elem);}).apply(null, arguments)',  
>   args:   [ { 'element-6066-11e4-a52e-4f735466cecf':
> 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C', ELEMENT:
> 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' } ] 
> }
> -> RESULT { 'element-6066-11e4-a52e-4f735466cecf':
> 'node-5D1721C6-39B1-425E-8751-2DF193491171' }
> 
> [POST]
> http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element/
> node-5D1721C6-39B1-425E-8751-2DF193491171/click
> ->ERROR-RESULT: A JavaScript exception occured: Argument 1 ('element') to
> Window.getComputedStyle must be an instance of Element

I am also running into this issue calling click or clear on an element inside shadowdom. 

http://127.0.0.1:4444/wd/hub/session/3957A8DD-87E9-47FA-BBA1-5F3FE9AB511C/element/node-D45B7A71-2F93-49D6-98AD-9821E0A0BCCC/clear

Resp: Argument 1 ('element') to Window.getComputedStyle must be an instance of Element
Comment 27 Brian Burg 2020-01-06 12:14:47 PST
(In reply to arian.ics from comment #26)
> (In reply to Jimmy Collazos from comment #21)
> > I have the same problem, but in my case is when the element is in shadow-dom
> > 
> > Idea:
> > =======
> > The element exist; but the service can't find and then execute
> > "Window.getComputedStyle" with null, undefined or similar
> > 
> > 
> > Safaridrier Version:
> > ====================
> > "included with Safari 13.0.3 (14608.3.10.10.1)"
> > 
> > 
> > Reproduce Requests:
> > ===================
> > [POST]
> > http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element
> > -> DATA { using: 'css selector', value: 'shop-app' }
> > -> RESULT { 'element-6066-11e4-a52e-4f735466cecf':
> > 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' }
> > 
> > [POST]
> > http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/execute/
> > sync
> > -> DATA { 
> >   script: 'return (function (elem) {return (function() {if (this.shadowRoot)
> > {return this.shadowRoot.querySelector(\'shop-home\')}return
> > this.querySelector(\'shop-home\')}).call(elem);}).apply(null, arguments)',  
> >   args:   [ { 'element-6066-11e4-a52e-4f735466cecf':
> > 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C', ELEMENT:
> > 'node-D5A74127-717A-4BFB-8E13-1AE3A6D96A5C' } ] 
> > }
> > -> RESULT { 'element-6066-11e4-a52e-4f735466cecf':
> > 'node-5D1721C6-39B1-425E-8751-2DF193491171' }
> > 
> > [POST]
> > http://127.0.0.1:4444/session/08D37203-AEDD-43DF-990A-900EC182648A/element/
> > node-5D1721C6-39B1-425E-8751-2DF193491171/click
> > ->ERROR-RESULT: A JavaScript exception occured: Argument 1 ('element') to
> > Window.getComputedStyle must be an instance of Element
> 
> I am also running into this issue calling click or clear on an element
> inside shadowdom. 
> 
> http://127.0.0.1:4444/wd/hub/session/3957A8DD-87E9-47FA-BBA1-5F3FE9AB511C/
> element/node-D45B7A71-2F93-49D6-98AD-9821E0A0BCCC/clear
> 
> Resp: Argument 1 ('element') to Window.getComputedStyle must be an instance
> of Element

Clicks cannot be targeted to innards of a Shadow DOM tree. That behavior is not spec'd, so that needs to happen first. Clicking the element itself should work. File a new bug if it doesn't.
Comment 28 Brian Burg 2020-01-06 12:14:59 PST
This works in Safari Technology Preview 97 in later.
Comment 29 Duncan Ariey 2020-01-14 08:11:16 PST
(In reply to Brian Burg from comment #28)
> This works in Safari Technology Preview 97 in later.

I've upgraded to STP 98 and am still experiencing the issue. Safaridriver is unable to click on buttons using standard click methods OR a Javascript click workaround.
Comment 30 Brian Burg 2020-01-14 09:00:14 PST
(In reply to Duncan Ariey from comment #29)
> (In reply to Brian Burg from comment #28)
> > This works in Safari Technology Preview 97 in later.
> 
> I've upgraded to STP 98 and am still experiencing the issue. Safaridriver is
> unable to click on buttons using standard click methods OR a Javascript
> click workaround.

Please file a new bug report including steps to reproduce / a reduced test case that I can use to debug. If you need an example of what I'm looking for, this repository is a great starting point. https://github.com/npeceniak/Safari_Iframe_Bug

Do not upload confidential/private information to Bugzilla. Instead, go to https://feedbackassistant.apple.com/, create a bug report, and upload information that way.

Thanks, Brian
Your lovely WebDriver maintainer
Comment 31 Duncan Ariey 2020-01-14 11:30:50 PST
(In reply to Brian Burg from comment #30)
> (In reply to Duncan Ariey from comment #29)
> > (In reply to Brian Burg from comment #28)
> > > This works in Safari Technology Preview 97 in later.
> > 
> > I've upgraded to STP 98 and am still experiencing the issue. Safaridriver is
> > unable to click on buttons using standard click methods OR a Javascript
> > click workaround.
> 
> Please file a new bug report including steps to reproduce / a reduced test
> case that I can use to debug. If you need an example of what I'm looking
> for, this repository is a great starting point.
> https://github.com/npeceniak/Safari_Iframe_Bug
> 
> Do not upload confidential/private information to Bugzilla. Instead, go to
> https://feedbackassistant.apple.com/, create a bug report, and upload
> information that way.
> 
> Thanks, Brian
> Your lovely WebDriver maintainer

Thank you Brian, just filed a report through feedbackassistant with the title "Safaridriver is unable to click on buttons."
Comment 32 Vikrant Kumar Chauhan 2020-01-17 14:47:51 PST
I've tested the original issue with STP 98 and seems to be working fine for me now.

Thanks for fixing it.

~ Vikrant
Comment 33 Rafael Lopez 2020-02-10 10:12:18 PST
Hi there!

How do I know when STP 98 is included in a final user version. Currently I have 13.0.3 (14608.4.9.1.4) and I'm still having the issue. I assume it doesn't include STP 98 changes.

Any page or reference that help me to know when STPs are released to final users?

Thanks,
Rafael
Comment 34 Slava 2020-02-27 02:50:44 PST
Hi guys, still have a problem with the click method, after clicking nothing happened. Other mac with old safari 12.1.1 (14607.2.6.1.1) and mojave 10.14.5 (18F132) works well.
Version 13.0.5 (15608.5.11)
Catalina 10.15.3 (19D76)

Somebody can give an advice about how to work around it?
Comment 35 Aaron W 2020-03-06 17:37:46 PST
I'm having the same issue still 
Version 13.0.5 (13608.5.12)
Comment 36 shricbe 2020-03-07 23:22:40 PST
Issue still seen in safari 13. Can someone help on the workaround/fix provided?
Comment 37 Brian Burg 2020-03-20 09:27:01 PDT
Please stop piling on with comments. This bug is closed and not being monitored.

If you still encounter a similar issue while using the latest Safari Technology Preview, please file a bug via feedbackassistant.apple.com or in the Safari Technology Preview menu via "Help > Report an Issue...". Commenting on old bugs about new issues won't get anything fixed for you, and I probably won't even see your comments. A new bug is the right way to go.

(WebKit Bugzilla is primarily a way to review and land patches, and is a poor system to track bug reports from users.)