Protractor error message “unsupported command-line flag” in Chrome?

后端 未结 9 1422
予麋鹿
予麋鹿 2020-12-23 20:35

I\'m a new user to Protractor, and I encountered this error running my tests using Chrome (error displays beneath the address bar in the launched browser):

相关标签:
9条回答
  • 2020-12-23 21:10

    If you use Protractor, this is probably the configuration you're looking for:

    capabilities : {
        browserName : 'chrome',
        'chromeOptions': {
            args: ['--test-type']
        }
    },
    
    0 讨论(0)
  • 2020-12-23 21:10

    The flag --ignore-certificate-errors has been added to the "bad flags" list as of Chrome 35, since it reduces the browser's security. The flag still works regardless.

    If you'd like to disable the "unsupported flag" prompt, add --test-type to the command-line flags you're using. This shouldn't affect the browser in any other noticeable way, but it's used for internal testing, so use it at your own risk.

    For more info on adding command-line flags, see the Chromedriver capability docs.

    0 讨论(0)
  • 2020-12-23 21:14

    This error also happened for me when I tried to run "npm run protractor" on step 3 of the Angular tutorial at https://docs.angularjs.org/tutorial/step_03

    I'm running Chrome Version 35.0.1916.153 on a MacBook Pro.

    @scheffield - thanks, your solution worked for me.

    (Also it may not be obvious on that tutorial step 3, but as in previous steps, you still have to start your web server by opening a new terminal window in the directory where you downloaded the tutorial and issuing "npm start". Then in a separate terminal window you execute "npm run protractor"). With the protractor config tweak the error went away.

    0 讨论(0)
  • 2020-12-23 21:16

    Code that worked for both local webdriver and remote driver scenarios for Ruby Bindings. This suppressed the warning message on chrome35 (Remember that you have to get 2.10 chromedriver.exe from http://chromedriver.storage.googleapis.com/index.html)

    Localwebdriver:

    caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["test-type" ]})
    
    @browser = Selenium::WebDriver.for :chrome,desired_capabilities: caps
    

    RemoteWebDriver (using GRID): Note that comma-separated-ips in the below code are the ips from which the grid hub is allowed to receive selenese commands. This security layer has been implemented from chrome35 and chromedriver 2.10 onwards

    caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["test-type","whitelisted-ips=comma-separated-ips"]})
    
    @browser =  Selenium::WebDriver.for :remote, :url => GRID_HUB_URL,:desired_capabilities => caps
    
    0 讨论(0)
  • 2020-12-23 21:31

    I am using Java, so I don't know if this will work for you, but it may help.

    In my case, adding .addArguments("test-type"); did actually hide that warning. However, it made execution amazingly slow.

    So I replaced that line with the following, and it worked fine!

    options.addArguments("excludeSwitches", "ignore-certificate-errors");
    
    0 讨论(0)
  • 2020-12-23 21:35
    System.setProperty("webdriver.chrome.driver","<<your chrome path>>");
        // To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors.
        // Stability and security will suffer."
        // Add an argument 'test-type'
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        ChromeOptions options = new ChromeOptions();
        options.addArguments("test-type");
        capabilities.setCapability("chrome.binary","<<your chrome path>>");
        capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    
        driver = new ChromeDriver(capabilities);
    

    **This worked for me too here is the code **

    0 讨论(0)
提交回复
热议问题