当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Options.addArguments方法代码示例

本文整理汇总了TypeScript中selenium-webdriver/chrome.Options.addArguments方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Options.addArguments方法的具体用法?TypeScript Options.addArguments怎么用?TypeScript Options.addArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium-webdriver/chrome.Options的用法示例。


在下文中一共展示了Options.addArguments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: CreateContext

export async function CreateContext() {
    if (envOpts.HEADLESS) {
        opts.addArguments('--headless', 'window-size=1192,870', '--no-sandbox')
        expect.extend({ toMatchImageSnapshot })
    }
    else {
        opts.addArguments('window-size=1200,1000')
        expect.extend({
            toMatchImageSnapshot: (received: any, ...actual: any[]) => {
                return {
                    message: () => 'NOOP',
                    pass: true
                }
            }
        })
    }

    opts.addArguments('--disable-rtc-smoothness-algorithm', '--disable-gpu-compositing', '--disable-gpu', '--force-device-scale-factor=1', '--disable-lcd-text')

    let driver = await new webdriver.Builder()
        .forBrowser('chrome')
        .setChromeOptions(opts)
        .build()

    let ctx = new Context(driver, envOpts.RUNDECK_URL, envOpts.S3_UPLOAD, envOpts.S3_BASE)

    return ctx
}
开发者ID:ahormazabal,项目名称:rundeck,代码行数:28,代码来源:selenium.ts

示例2: TestChromeOptions

function TestChromeOptions() {
    let options: chrome.Options = new chrome.Options();
    options = chrome.Options.fromCapabilities(webdriver.Capabilities.chrome());

    options = options.addArguments('a', 'b', 'c');
    options = options.addExtensions('a', 'b', 'c');
    options = options.excludeSwitches('a', 'b', 'c');
    options = options.detachDriver(true);
    options = options.setChromeBinaryPath('path');
    options = options.setChromeLogFile('logfile');
    options = options.setLocalState('state');
    options = options.androidActivity('com.example.Activity');
    options = options.headless();
    options = options.androidDeviceSerial('emulator-5554');
    options = options.androidChrome();
    options = options.androidPackage('com.android.chrome');
    options = options.androidProcess('com.android.chrome');
    options = options.androidUseRunningApp(true);
    options = options.setLoggingPrefs(new webdriver.logging.Preferences());
    options = options.setPerfLoggingPrefs({
        enableNetwork: true, enablePage: true, enableTimeline: true,
        tracingCategories: 'category', bufferUsageReportingInterval: 1000 });
    options = options.setProxy({ proxyType: 'proxyType' });
    options = options.setUserPreferences('preferences');
    let capabilities: webdriver.Capabilities = options.toCapabilities();
    capabilities = options.toCapabilities(webdriver.Capabilities.chrome());
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:27,代码来源:chrome.ts

示例3: async

 const buildDriverInstance = async () => {
   switch (browserType) {
     case 'chrome':
       const chromeOptions = new chrome.Options();
       const loggingPref = new logging.Preferences();
       loggingPref.setLevel(logging.Type.BROWSER, logging.Level.ALL);
       chromeOptions.setLoggingPrefs(loggingPref);
       if (process.env.TEST_BROWSER_HEADLESS) {
         // Use --disable-gpu to avoid an error from a missing Mesa library, as per
         // See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
         chromeOptions.addArguments('headless', 'disable-gpu');
       }
       return new Builder()
         .forBrowser(browserType)
         .setChromeOptions(chromeOptions)
         .setChromeService(new chrome.ServiceBuilder(chromeDriver.path).enableVerboseLogging())
         .build();
     case 'firefox':
       const firefoxOptions = new firefox.Options();
       if (process.env.TEST_BROWSER_HEADLESS) {
         // See: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode
         firefoxOptions.addArguments('-headless');
       }
       return new Builder()
         .forBrowser(browserType)
         .setFirefoxOptions(firefoxOptions)
         .setFirefoxService(new firefox.ServiceBuilder(geckoDriver.path).enableVerboseLogging())
         .build();
     default:
       throw new Error(`${browserType} is not supported yet`);
   }
 };
开发者ID:spalger,项目名称:kibana,代码行数:32,代码来源:webdriver.ts

示例4: TestChromeOptions

function TestChromeOptions() {
    var options: chrome.Options = new chrome.Options();
    options = chrome.Options.fromCapabilities(webdriver.Capabilities.chrome());

    options = options.addArguments("a", "b", "c");
    options = options.addExtensions("a", "b", "c");
    options = options.excludeSwitches("a", "b", "c");
    options = options.detachDriver(true);
    options = options.setChromeBinaryPath("path");
    options = options.setChromeLogFile("logfile");
    options = options.setLocalState("state");
    options = options.androidActivity("com.example.Activity");
    options = options.androidDeviceSerial("emulator-5554");
    options = options.androidChrome();
    options = options.androidPackage("com.android.chrome");
    options = options.androidProcess("com.android.chrome");
    options = options.androidUseRunningApp(true);
    options = options.setLoggingPrefs(new webdriver.logging.Preferences());
    options = options.setPerfLoggingPrefs({ enableNetwork: true, enablePage: true, enableTimeline: true, tracingCategories: "category", bufferUsageReportingInterval: 1000 });
    options = options.setProxy({ proxyType: "proxyType" });
    options = options.setUserPreferences("preferences");
    var capabilities: webdriver.Capabilities = options.toCapabilities();
    capabilities = options.toCapabilities(webdriver.Capabilities.chrome());
}
开发者ID:KostyaTretyak,项目名称:DefinitelyTyped,代码行数:24,代码来源:selenium-webdriver-tests.ts


注:本文中的selenium-webdriver/chrome.Options.addArguments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。