Is there a way to detect that I'm in a Selenium Webdriver page from JavaScript

前端 未结 5 571
无人共我
无人共我 2021-02-02 17:03

I\'d like to suppress the initialization of TinyMCE inside my tests and can do this easily if the JavaScript can detect that I\'m running inside a Selenium-automated page.

<
5条回答
  •  走了就别回头了
    2021-02-02 17:42

    Here's how to do it with Capybara and Chromedriver:

    Capybara.register_driver :selenium do |app|
      Capybara::Selenium::Driver.new(app, browser: :chrome,
        args: ['--user-agent="Chrome under Selenium for Capybara"'] )
    end
    

提交回复
热议问题