Is there a flag for disabling the "Leave site?" dialog in a test run?

108 views
Skip to first unread message

Jason Fleetwood-Boldt

unread,
Apr 20, 2023, 2:32:01 PM4/20/23
to ChromeDriver Users
my chromedriver setup for my Capybara (selenium) app is fairly standard:asdf


Capybara.register_driver :chromeXYZ do |app|
  options = {}
  options[:args] = ['disable-gpu',
                    'window-size=1280,1024',
                    'no-sandbox',
                    'disable-dev-shm-usage']

  Capybara::Selenium::Driver.new(app, browser: :chrome,
                                 options: Selenium::WebDriver::Chrome::Options.new(options))
end

 
in my test while NOT running headless (as above), I see this dialog pop up a few times in the test run: 

Leave site?
Changes you made may not be saved.

Is there a chrome flag to disable that dialog? It doesn't seem to block anything or cause the test to fail, because when the test runner (Ruby) shuts down the chromedriver, it seems like it closes both the real window and the dialog box at the same time. 

but I'm worried it might be causing other issues, as the test suite can be flaky. in particular, I see Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally intermittently, which is odd because that seems to happen when run locally sometimes but not other times (so I'm trying to eliminate anything that could be related or the cause of that)

Jason


Screenshot 2023-04-20 at 2.20.02 PM.png
Reply all
Reply to author
Forward
0 new messages