Skip to content

[🐛 Bug]: Setting unhandledPromptBehavior to a hash is not possible in ruby #16159

@nhasselmeyer

Description

@nhasselmeyer

Description

I'm trying to set unhandledPromptBehavior to the hash { 'default' => 'ignore' }. This throws a Selenium::WebDriver::Error::InvalidArgumentError with the message

invalid argument: cannot parse capability: unhandledPromptBehavior
from invalid argument: Unexpected value {\"default\" => \"ignore\"} in capabilities

The culprit seems to be in lib/selenium/webdriver/common/options.rb:134, where the :unhandled_prompt_behavior key is converted to a string (most likely to convert :accept_and_ignore to "accept and ignore"). This makes it impossible to pass a hash to the browser.

Without that line, the browser accepts the hash argument and handles alerts as expected.

Reproducible Code

require 'selenium-webdriver'

options = Selenium::WebDriver::Chrome::Options.new
options.add_option(:unhandled_prompt_behavior, { 'default' => 'ignore' })

driver = Selenium::WebDriver.for :chrome, options: options # This raises the error
driver.quit

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!C-rbRuby BindingsD-chromeI-defectSomething is not working as intendedOS-linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions