Skip to content

Incorrect error when unexpected alert open #750

@jugglinmike

Description

@jugglinmike
  • Platform: GNU/Linux (Ubuntu 16.04)
  • Firefox version: 53.0.2 (64-bit)
  • GeckoDriver version: 0.16.1
  • Selenium Python bindings version: 3.4.2

Given the following code, I would expect the final command to fail with an
error of type "unexpected alert open". Instead, the server responds with an
"unknown error" whose message states, "Failed to find value field".

Demo script:

from selenium import webdriver

browser = webdriver.Firefox()
browser.get('data:text/html,<h1>Hello world</h1><p>pasd</p>')
browser.execute_script('setTimeout(function() { alert("Hello"); }, 0);')

try:
    print browser.title()
finally:
    browser.quit()

GeckoDriver log (captured using option --log debug)

1495476768842	webdriver::httpapi	DEBUG	Creating routes
1495476768845	geckodriver	INFO	Listening on 127.0.0.1:34689
1495476769846	webdriver::server	DEBUG	→ POST /session {"capabilities": {"alwaysMatch": {"acceptInsecureCerts": true, "browserName": "firefox"}, "firstMatch": []}, "desiredCapabilities": {"acceptInsecureCerts": true, "browserName": "firefox"}}
1495476769846	geckodriver::capabilities	DEBUG	Trying to read firefox version from ini files
1495476769846	geckodriver::capabilities	DEBUG	Found version 53.0.2
1495476769904	geckodriver::marionette	INFO	Starting browser /usr/lib/firefox/firefox.sh with args ["-marionette"]
1495476770783	Marionette	DEBUG	Marionette enabled via command-line flag
1495476771995	Marionette	INFO	Listening on port 42295
1495476772012	geckodriver::marionette	DEBUG	Connected to Marionette on localhost:42295
1495476772024	Marionette	DEBUG	Accepted connection conn0 from 127.0.0.1:34246
1495476772038	Marionette	CONFIG	Matched capabilities: {"browserName":"firefox","browserVersion":"53.0.2","platformName":"linux","platformVersion":"4.8.0-49-generic","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":646,"moz:profile":"/tmp/rust_mozprofile.AhEOclE0dONq","moz:accessibilityChecks":false}
1495476772039	Marionette	WARN	TLS certificate errors will be ignored for this session
1495476772399	webdriver::server	DEBUG	← 200 OK {"value": {"sessionId":"9c178a0f-f2e9-4606-bfde-0f13eeabef2d","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"53.0.2","moz:accessibilityChecks":false,"moz:processID":646,"moz:profile":"/tmp/rust_mozprofile.AhEOclE0dONq","pageLoadStrategy":"normal","platformName":"linux","platformVersion":"4.8.0-49-generic","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
1495476772401	webdriver::server	DEBUG	→ POST /session/9c178a0f-f2e9-4606-bfde-0f13eeabef2d/url {"url": "data:text/html,<h1>Hello world</h1><p>pasd</p>", "sessionId": "9c178a0f-f2e9-4606-bfde-0f13eeabef2d"}
1495476772498	webdriver::server	DEBUG	← 200 OK {"value": {}}
1495476772499	webdriver::server	DEBUG	→ POST /session/9c178a0f-f2e9-4606-bfde-0f13eeabef2d/execute/sync {"sessionId": "9c178a0f-f2e9-4606-bfde-0f13eeabef2d", "args": [], "script": "setTimeout(function() { alert(\"Hello\"); }, 0);"}
1495476772516	webdriver::server	DEBUG	← 200 OK {"value":null}
1495476772518	webdriver::server	DEBUG	→ GET /session/9c178a0f-f2e9-4606-bfde-0f13eeabef2d/title 
1495476772554	webdriver::server	DEBUG	← 500 Internal Server Error {"value":{"error":"unknown error","message":"Failed to find value field","stacktrace":"stack backtrace:\n   0:           0x4fa94d - backtrace::backtrace::trace::h45ace4059cd74233\n   1:           0x4fae32 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc\n   2:           0x445fdf - geckodriver::marionette::MarionetteSession::response::hac27afe85c07f033\n   3:           0x443b14 - <geckodriver::marionette::MarionetteHandler as webdriver::server::WebDriverHandler<geckodriver::marionette::GeckoExtensionRoute>>::handle_command::hd89c5efbeb4c7cd5\n   4:           0x434e94 - webdriver::server::start::{{closure}}::h5e71183f67357de6\n   5:           0x408627 - std::panicking::try::do_call::h8c30e6af4c7f85af\n   6:           0x5b77fa - panic_unwind::__rust_maybe_catch_panic\n                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libpanic_unwind/lib.rs:98\n   7:           0x416e57 - <F as alloc::boxed::FnBox<A>>::call_box::h3f273b2445d78deb\n   8:           0x5b0014 - alloc::boxed::{{impl}}::call_once<(),()>\n                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/liballoc/boxed.rs:624\n                         - std::sys_common::thread::start_thread\n                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys_common/thread.rs:21\n                         - std::sys::imp::thread::{{impl}}::new::thread_start\n                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys/unix/thread.rs:84"}}
1495476772557	webdriver::server	DEBUG	→ DELETE /session/9c178a0f-f2e9-4606-bfde-0f13eeabef2d 
1495476772567	Marionette	INFO	New connections will no longer be accepted
1495476772572	webdriver::server	DEBUG	Deleting session
1495476772572	geckodriver::marionette	DEBUG	Stopping browser process
1495476772587	webdriver::server	DEBUG	← 200 OK {"value": {}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions