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


TypeScript Capabilities.chrome方法代码示例

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


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

示例1: TestBy

function TestBy() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let locator: webdriver.By = new webdriver.By('class name', 'class');

    let str: string = locator.toString();

    locator = webdriver.By.className('class');
    locator = webdriver.By.css('css');
    locator = webdriver.By.id('id');
    locator = webdriver.By.linkText('link');
    locator = webdriver.By.name('name');
    locator = webdriver.By.partialLinkText('text');
    locator = webdriver.By.tagName('tag');
    locator = webdriver.By.xpath('xpath');

    // Can import 'By' without import declarations
    let By = webdriver.By;

    let locatorHash: webdriver.ByHash;
    locatorHash = { className: 'class' };
    locatorHash = { css: 'css' };
    locatorHash = { id: 'id' };
    locatorHash = { linkText: 'link' };
    locatorHash = { name: 'name' };
    locatorHash = { partialLinkText: 'text' };
    locatorHash = { tagName: 'tag' };
    locatorHash = { xpath: 'xpath' };

    webdriver.By.js('script', 1, 2, 3)(driver).then((abc: number) => {});
}
开发者ID:DxCx,项目名称:DefinitelyTyped,代码行数:33,代码来源:index.ts

示例2: TestWebDriverOptions

function TestWebDriverOptions() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let options: webdriver.Options = new webdriver.Options(driver);
    let promise: webdriver.promise.Promise<void>;

    let name: string = 'name';
    let value: string = 'value';
    let path: string = 'path';
    let domain: string = 'domain';
    let secure: boolean = true;
    let httpOnly: boolean = true;

    // Add Cookie
    promise = options.addCookie({ name, value });
    promise = options.addCookie({ name, value, path });
    promise = options.addCookie({ name, value, path, domain });
    promise = options.addCookie({ name, value, path, domain, secure });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: 123 });
    promise = options.addCookie({ name, value, path, domain, secure, httpOnly, expiry: Date.now() });

    promise = options.deleteAllCookies();
    promise = options.deleteCookie('name');
    options.getCookie('name').then((cookie: webdriver.IWebDriverCookie) => {
        let expiry: number = cookie.expiry;
     });
    options.getCookies().then((cookies: webdriver.IWebDriverCookie[]) => { });

    let logs: webdriver.Logs = options.logs();
    let timeouts: webdriver.Timeouts = options.timeouts();
    let window: webdriver.Window = options.window();
}
开发者ID:kittimiyo,项目名称:DefinitelyTyped,代码行数:35,代码来源:index.ts

示例3: TestWebDriverOptions

function TestWebDriverOptions() {
    var driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    var options: webdriver.Options = new webdriver.Options(driver);
    var promise: webdriver.promise.Promise<void>;

    // Add Cookie
    promise = options.addCookie('name', 'value');
    promise = options.addCookie('name', 'value', 'path');
    promise = options.addCookie('name', 'value', 'path', 'domain');
    promise = options.addCookie('name', 'value', 'path', 'domain', true);
    promise = options.addCookie('name', 'value', 'path', 'domain', true, 123);
    promise = options.addCookie('name', 'value', 'path', 'domain', true, Date.now());

    promise = options.deleteAllCookies();
    promise = options.deleteCookie('name');
    options.getCookie('name').then(function (cookies: webdriver.IWebDriverOptionsCookie) { });
    options.getCookies().then(function (cookies: webdriver.IWebDriverOptionsCookie[]) { });

    var logs: webdriver.Logs = options.logs();
    var timeouts: webdriver.Timeouts = options.timeouts();
    var window: webdriver.Window = options.window();
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:25,代码来源:index.ts

示例4: TestUntilModule

function TestUntilModule() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let conditionB: webdriver.Condition<boolean> = new webdriver.Condition<boolean>('message', (driver: webdriver.WebDriver) => true);
    let conditionBBase: webdriver.Condition<boolean> = conditionB;
    let conditionWebElement: webdriver.WebElementCondition;
    let conditionWebElements: webdriver.Condition<webdriver.WebElement[]>;

    conditionB = webdriver.until.ableToSwitchToFrame(5);
    let conditionAlert: webdriver.Condition<webdriver.Alert> = webdriver.until.alertIsPresent();
    let el: webdriver.WebElement = driver.findElement(webdriver.By.id('id'));
    conditionB = webdriver.until.stalenessOf(el);
    conditionB = webdriver.until.titleContains('text');
    conditionB = webdriver.until.titleIs('text');
    conditionB = webdriver.until.titleMatches(/text/);
    conditionB = webdriver.until.urlContains('text');
    conditionB = webdriver.until.urlIs('text');
    conditionB = webdriver.until.urlMatches(/text/);

    conditionWebElement = webdriver.until.elementIsDisabled(el);
    conditionWebElement = webdriver.until.elementIsEnabled(el);
    conditionWebElement = webdriver.until.elementIsNotSelected(el);
    conditionWebElement = webdriver.until.elementIsNotVisible(el);
    conditionWebElement = webdriver.until.elementIsSelected(el);
    conditionWebElement = webdriver.until.elementIsVisible(el);
    conditionWebElement = webdriver.until.elementLocated(webdriver.By.id('id'));
    conditionWebElement = webdriver.until.elementTextContains(el, 'text');
    conditionWebElement = webdriver.until.elementTextIs(el, 'text');
    conditionWebElement = webdriver.until.elementTextMatches(el, /text/);
    conditionWebElements = webdriver.until.elementsLocated(webdriver.By.className('class'));
}
开发者ID:kittimiyo,项目名称:DefinitelyTyped,代码行数:33,代码来源:index.ts

示例5: constructor

    constructor(browser: string, headlessMode: boolean = false, logger?: winston.Logger) {

        if(logger){
            this.logger =logger;
        }else {
            this.logger = winston.loggers.get('tasteeLog');
            this.logger.configure({
                level: 'info',
                format: winston.format.combine(
                    winston.format.colorize(),
                    winston.format.splat(),
                    winston.format.simple()
                  ),
                transports: [
                    new winston.transports.Console()
                ]
              });
        }

        if (browser) {
            let webdriver = require('selenium-webdriver');
            switch (browser) {
                case 'chrome':
                    if (headlessMode) {
                        var chrome = require('selenium-webdriver/chrome');
                        this.driver = new webdriver.Builder()
                            .withCapabilities(selenium.Capabilities.chrome())
                            .setChromeOptions(new chrome.Options().headless())
                            .build();
                    }
                    else {
                        this.driver = new webdriver.Builder()
                            .forBrowser('chrome')
                            .build();
                    }
                    break;
                case 'firefox':
                    if (headlessMode) {
                        var firefox = require('selenium-webdriver/firefox');
                        this.driver = new webdriver.Builder()
                            .withCapabilities(selenium.Capabilities.firefox())
                            .setFirefoxOptions(new firefox.Options().headless())
                            .build();
                    }
                    else {
                        this.driver = new webdriver.Builder()
                            .forBrowser('firefox')
                            .build();
                    }
                    break;
                default:
                    this.driver = new webdriver.Builder()
                        .forBrowser('phantomjs')
                        .build();
                    break;
            }
        }
        this.reporter = new TasteeReporter();
    }
开发者ID:tastee,项目名称:tastee-core,代码行数:59,代码来源:tastee-engine.ts

示例6: TestRemoteFileDetector

function TestRemoteFileDetector() {
    const driver: webdriver.WebDriver = new webdriver.Builder()
        .withCapabilities(webdriver.Capabilities.chrome())
        .build();

    const fileDetector: remote.FileDetector = new remote.FileDetector();
    fileDetector.handleFile(driver, 'path/to/file').then((path: string) => { /* empty */ });
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:8,代码来源:remote.ts

示例7: TestWebDriverFileDetector

function TestWebDriverFileDetector() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let fileDetector: webdriver.FileDetector = new webdriver.FileDetector();

    fileDetector.handleFile(driver, 'path/to/file').then((path: string) => {});
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:9,代码来源:index.ts

示例8: _goToWiki

  @AsyncSetup
  private async _goToWiki() {
    // create a driver if one hasn't yet been created
    this._driver = new Builder()
      .withCapabilities(Capabilities.chrome())
      .build();

    // go to the wiki home page
    await this._driver.get("https://github.com/alsatian-test/alsatian/wiki");
  }
开发者ID:alsatian-test,项目名称:alsatian,代码行数:10,代码来源:alsatian-wiki.spec.ts

示例9: TestWebDriverLogs

function TestWebDriverLogs() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let logs: webdriver.Logs = new webdriver.Logs(driver);

    logs.get(webdriver.logging.Type.BROWSER).then((entries: webdriver.logging.Entry[]) => {});
    logs.getAvailableLogTypes().then((types: string[]) => {});
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:10,代码来源:index.ts

示例10: TestActionSequence

function TestActionSequence() {
    var driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    var sequence: webdriver.ActionSequence = new webdriver.ActionSequence(driver);
    var element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId');
    var promise: webdriver.promise.Promise<string>;
    element = new webdriver.WebElement(driver, promise);

    // Click
    sequence = sequence.click();
    sequence = sequence.click(webdriver.Button.LEFT);
    sequence = sequence.click(element);
    sequence = sequence.click(element, webdriver.Button.LEFT);

    // DoubleClick
    sequence = sequence.doubleClick();
    sequence = sequence.doubleClick(webdriver.Button.LEFT);
    sequence = sequence.doubleClick(element);
    sequence = sequence.doubleClick(element, webdriver.Button.LEFT);

    // DragAndDrop
    sequence = sequence.dragAndDrop(element, element);
    sequence = sequence.dragAndDrop(element, { x: 1, y: 2 });

    // KeyDown
    sequence = sequence.keyDown(webdriver.Key.ADD);

    // KeyUp
    sequence = sequence.keyUp(webdriver.Key.ADD);

    // MouseDown
    sequence = sequence.mouseDown();
    sequence = sequence.mouseDown(webdriver.Button.LEFT);
    sequence = sequence.mouseDown(element);
    sequence = sequence.mouseDown(element, webdriver.Button.LEFT);

    // MouseMove
    sequence = sequence.mouseMove(element);
    sequence = sequence.mouseMove({ x: 1, y: 1 });
    sequence = sequence.mouseMove(element, { x: 1, y: 2 });

    // MouseUp
    sequence = sequence.mouseUp();
    sequence = sequence.mouseUp(webdriver.Button.LEFT);
    sequence = sequence.mouseUp(element);
    sequence = sequence.mouseUp(element, webdriver.Button.LEFT);

    // SendKeys
    sequence = sequence.sendKeys('A', 'B', 'C');
    sequence = sequence.sendKeys('A', webdriver.Key.NULL);

    sequence.perform().then(() => {});
}
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:55,代码来源:index.ts


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