1

I'm doing some automated testing (with Selenium and Webdriverjs) and I notice when the Chrome window lacks focus, the execution slows down signifigantly. Is there a flag/configuratin setting I can set to stop it from "throttling down"?

Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81

2 Answers2

2

Cody's answer suggesting switch could work if you find the one that applies to your situation, however I didn't find any. So I'll provide code on how to apply switches, also a javascript hack to bring the focus of the window

  var webdriver = require('selenium-webdriver'),
    capabilities = webdriver.Capabilities.chrome();
    var switches = {
        'args' : ['--start-maximized']
    };
    capabilities.set('chromeOptions', switches); 
    var driver = new webdriver.Builder()
    .withCapabilities(capabilities)
    .build();
  driver.executeScript('window.focus();'); //JS hack to bring the focus
nilesh
  • 14,131
  • 7
  • 65
  • 79
1

I couldn't see one that does exactly what you are describing, but you could take a look at the many options on this page and see if one applies to your situation. It looks like the page stays updated pretty frequently.

http://peter.sh/experiments/chromium-command-line-switches/

This may be useful if you are accessing them via extensions.

https://www.chromium.org/for-testers/backend-testing/extensions-http-throttling-testing

Cody Stevens
  • 424
  • 4
  • 9