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

Viewed 20182

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.

So, is there some JavaScript code that I can use to detect the Selenium driver? Alternatively, how can I extend the userAgent string to include a pattern that I can detect from JavaScript?

If it really matters, I'm running this through Cucumber and Capybara on Mac OS X.

5 Answers

You can try this answer to disable the navigator.webdriver variable, but notice that it's no longer from ChromeDriver 79.0.3945.16 and above.

Related