Skip to content

SafariDriver Immediately Releases Click Events. Does not Check Pending Navigation.  #1511

@azohra

Description

@azohra

This was reported in 2014 but never triaged/addressed. See Google Code - Open Issues

The issue: After clicking a link / button using SafariDriver, it appears there is no check for pending navigation requests before releasing the click event as complete.

The Consequence: Click actions which result in a page refresh or redirect are released before the refresh/redirect occurs and thus proceeding actions are kicked off too early and fail consistently.

The Workaround: Add element level waits after click-through events to stop SafariDriver from submitting the next actions too early. Downside is the element-wait timeout is being eaten up by page load. Moreover, because the click has been released as successful, any failure is attributed to the next action rather than the click.

The Solution: Have SafariDriver behave similar to ChromeDriver in which pending navigations are checked before releasing the click action. My fear is that there is a good reason why SafariDriver cannot do this, and perhaps this is why the issue was never addressed. If this is the case, it would just be great to understand the limitation and hear if there are better / other workarounds.

Here are some details from the original ticket post to help illustrate the matter.

SafariDriver log:

14:37:57.86 [safaridriver.extension.Server] [779h50wyyvq2] Received a message: {"origin":"webdriver","type":"command","command":{"id":"79","name":"clickElement","parameters":{"id":":wdc:1412681861302"}}}
14:37:57.87 [safaridriver.extension.Server] [779h50wyyvq2] Executing command: clickElement
14:37:57.87 [safaridriver.extension.Tab] [2ymt8tn075fa] Sending message: {"origin":0,"type":"command","command":{"id":"9hv7rx7u2env","name":"clickElement","parameters":{"id":":wdc:1412681861302"}}}
14:37:57.87 [safaridriver.inject._Top_] [p1s4okvij0cl] Executing {"id":"9hv7rx7u2env","name":"clickElement","parameters":{"id":":wdc:1412681861302"}}
14:37:57.88 [safaridriver.extension.Tab] [2ymt8tn075fa] Received response: {"origin":1,"type":"response","id":"9hv7rx7u2env","response":{"status":0,"value":null}}
14:37:57.88 [safaridriver.extension.Server] [779h50wyyvq2] Sending response: {"origin":0,"type":"response","id":"79","response":{"status":0,"value":null}}

ChromeDriver log:

[26.534][INFO]: COMMAND ClickElement {
   "id": "0.7670850940048695-14"
}
[26.534][INFO]: Waiting for pending navigations...
[26.534][INFO]: Done waiting for pending navigations
[26.594][INFO]: Waiting for pending navigations...
[38.981][INFO]: Done waiting for pending navigations
[38.981][INFO]: RESPONSE ClickElement

under SafariDriver response for click action is being sent immediately after click but, this click leads to another page and it should send a response when new page loaded(like under ChromeDriver).

Selenium Version: 2.48.2 / 2.49.0
OS Version: Mac OS X Yosemite / El Capitan
Browse Version: Safari 9.0 / 9.0.1 / 9.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions