While executing my selenium scripts, I encounter a severe crash specifically when running the Safari web browser and clicking certain links.
The majority of click actions work fine with the Safari Webdriver. However, performing either webElement.click()
or
webElement.actions.clickAndHold([some web element]).perform()
will cause the driver to crash.
This issue only arises when clicking on footer jump links, which are links that scroll down to the footer of the page upon being clicked.
Interestingly, this problem is exclusive to Safari; Chrome, Firefox, and other browsers do not experience this crash.
Has anyone faced a similar situation? Are there any workarounds available, such as alternative methods for clicking on web elements?
This complication surfaced when Safari 12.1.1 was released; prior to that, everything was functioning properly.
I suspect the following section of JavaScript code on the webpage might be triggering the crash:
$.each(t, function(n, t) {
var i = $(t)
, r = p(i);
r && r.not("[tabindex],input,textarea").attr("tabindex", -1);
r && (i.data("anchor") ? console.warn("%c attr [data-anchor] is deprecated; use [href] or [data-jump-target] instead", "background: #222; color: #7fda55; font-size: 14px; padding: 4px", i[0]) : i.is(".jumpLink, .anchor-link, .superscript-link") && console.warn('%c classes .jumpLink, .anchor-link, .superscript-link for anchors are deprecated; use <a href="#value"> or <div data-jump-target="value"> instead', "background: #222; color: #7fda55; font-size: 12px; padding: 2px", i[0]))
});
Additionally, here is the error thrown by Safari:
Process: Safari [24240]
Path: /Applications/Safari.app/Contents/MacOS/Safari
Identifier: com.apple.Safari
Version: 12.1.1 (14607.2.6.1.1)
Build Info: WebBrowser-7607002006001001~3
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Safari [24240]
User ID: 502
Date/Time: 2019-06-21 15:16:23.521 -0600
OS Version: Mac OS X 10.14.5 (18F203)
Report Version: 12
Bridge OS Version: 3.5 (16P5200)
Anonymous UUID: 56C84AF4-983B-688C-12EB-52065287562D
Sleep/Wake UUID: 6B696843-31A9-4795-B29B-E3D128CE40A4
Time Awake Since Boot: 57000 seconds
Time Since Wake: 720 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [24240]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.WebKit 0x00007fff49065320 WTF::Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<WebKit::AutomationCommandError>)>::CallableWrapper<WebKit::SimulatedInputDispatcher::resolveLocation(WebCore::IntPoint const&, WTF::Optional<WebCore::IntPoint>, Inspector::Protocol::Automation::MouseMoveOrigin, WTF::Optional<WTF::String>, WTF::Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<WebKit::AutomationCommandError>)>&&)::$_2>::call(WTF::Optional<WebCore::IntPoint>, WTF::Optional<WebKit::AutomationCommandError>) + 346
1 com.apple.WebKit 0x00007fff49053bd6 WTF::Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<WebKit::AutomationCommandError>)>::operator()(WTF::Optional<WebCore::IntPoint>, WTF::Optional<WebKit::AutomationCommandError>) const + 72
2 com.apple.WebKit 0x00007fff4905a707 WebKit::WebAutomationSession::didComputeElementLayout(unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String const&) + 1283
3 com.apple.WebKit 0x00007fff49161b12 void IPC::callMemberFunctionImpl<WebKit::WebAutomationSession, void (WebKit::WebAutomationSession::*)(unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String const&), std::__1::tuple<unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String>, 0ul, 1ul, 2ul, 3ul, 4ul>(WebKit::WebAutomationSession*, void (WebKit::WebAutomationSession::*)(unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String const&), std::__1::tuple<unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul>) + 91
4 com.apple.WebKit 0x00007fff491615f0 void IPC::handleMessage<Messages::WebAutomationSession::DidComputeElementLayout, WebKit::WebAutomationSession, void (WebKit::WebAutomationSession::*)(unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String const&)>(IPC::Decoder&, WebKit::WebAutomationSession*, void (WebKit::WebAutomationSession::*)(unsigned long long, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool, WTF::String const&)) + 99
5 com.apple.WebKit 0x00007fff48e0e9b6 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 64
(the complete error message continues beyond this point).