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

前端 未结 5 594
无人共我
无人共我 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 18:07

    Since the question mentions Capybara, here's the equivalent code in Ruby:

    profile = Selenium::WebDriver::Firefox::Profile.new
    profile['general.useragent.override'] = "my ua string"
    
    driver = Selenium::WebDriver.for :firefox, :profile => profile
    

提交回复
热议问题