Unable to open chrome browser using Selenium Webdriver. Loading unpacked extensions are disabled by administrator

前端 未结 7 1498
名媛妹妹
名媛妹妹 2021-01-01 05:50

I am automating my application using Selenium Webdriver, C#, Visual Studio and Chrome browser.

I am getting below popup when selenium tried to open the chrome browse

相关标签:
7条回答
  • 2021-01-01 06:23

    According to ChromeDriver Issues use the following:

    chromeOptions: {
        args: ['--start-maximized', '--disable-extensions'],
        useAutomationExtension: false
    }
    

    Extra: For using Selenium with Cucumber-js

    require('chromedriver')
    var seleniumWebdriver = require('selenium-webdriver');
    var {defineSupportCode} = require('cucumber');
    
    function CustomWorld() {
    
      var chromeCapabilities = seleniumWebdriver.Capabilities.chrome();
    
      var chromeOptions = {
        'args': ['--disable-extensions', '--start-maximized'],
        'useAutomationExtension': false
      };
    
      chromeCapabilities.set('chromeOptions', chromeOptions);
    
      this.driver = new seleniumWebdriver.Builder()
        .forBrowser('chrome')
        .withCapabilities(chromeCapabilities)
        .build();
    }
    
    defineSupportCode(function({setWorldConstructor}) {
      setWorldConstructor(CustomWorld)
    })
    
    0 讨论(0)
提交回复
热议问题