List of Firefox and Chrome arguments/preferences

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-21 04:56:41

问题


As a tester,
I would like to study a list of possible configuration arguments for Firefox and Chrome,
So that I can configure my testing tools with knowledge


Reading API indicates that there are methods with whom we can pass arguments to a webdriver instance:

FirefoxOptions.AddArgument
FirefoxOptions.SetLoggingPreference (inherited from DriverOptions)
FirefoxOptions.SetPreference

What exactly can be the possible arguments passed to these methods and what they do ?
Is there a resource online with a detailed list per each browser ?


回答1:


Resources for Firefox:
http://kb.mozillazine.org/About:config_entries
http://kb.mozillazine.org/Category:Preferences

Example usage:

firefoxProfile.setPreference("app.update.enabled", false);

Resources for Chrome:
https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/chrome_switches.cc?view=markup

Example usage:

chromeOptions.addArguments("--start-maximized");



回答2:


I`m currently using following arguments in Chrome. Hope this would help someone. The names of the arguments are easy to understand since it makes sense.

    ChromeOptions chromeOptions = new ChromeOptions();

    chromeOptions.addArguments("--headless");
    chromeOptions.addArguments("start-maximized");
    chromeOptions.addArguments("--disable-gpu");
    chromeOptions.addArguments("--start-fullscreen");
    chromeOptions.addArguments("--disable-extensions");
    chromeOptions.addArguments("--disable-popup-blocking");
    chromeOptions.addArguments("--disable-notifications");
    chromeOptions.addArguments("--window-size=1920,1080");
    chromeOptions.addArguments("--no-sandbox");
    chromeOptions.addArguments("--dns-prefetch-disable");
    chromeOptions.addArguments("enable-automation");
    chromeOptions.addArguments("disable-features=NetworkService");

    WebDriver driver = new ChromeDriver(chromeOptions);


来源:https://stackoverflow.com/questions/42529853/list-of-firefox-and-chrome-arguments-preferences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!