• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript selenium-webdriver.Capabilities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TestWebDriverWindow

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

    let window: webdriver.Window = new webdriver.Window(driver);
    let locationPromise: webdriver.promise.Promise<webdriver.ILocation>;
    let sizePromise: webdriver.promise.Promise<webdriver.ISize>;
    let voidPromise: webdriver.promise.Promise<void>;

    locationPromise = window.getPosition();
    sizePromise = window.getSize();
    voidPromise = window.maximize();
    voidPromise = window.setPosition(12, 34);
    voidPromise = window.setSize(12, 34);
}
开发者ID:lionelB,项目名称:DefinitelyTyped,代码行数:16,代码来源:index.ts


示例2: TestWebElement

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

    var promise: webdriver.promise.Promise<string>;
    var element: webdriver.WebElement;

    element = new webdriver.WebElement(driver, 'elementId');
    element = new webdriver.WebElement(driver, promise);

    var voidPromise: webdriver.promise.Promise<void>;
    var stringPromise: webdriver.promise.Promise<string>;
    var booleanPromise: webdriver.promise.Promise<boolean>;

    voidPromise = element.clear();
    voidPromise = element.click();

    element = element.findElement(webdriver.By.id('ABC'));
    element.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
    booleanPromise = element.isElementPresent(webdriver.By.className('ABC'));

    stringPromise = element.getAttribute('class');
    stringPromise = element.getCssValue('display');
    driver = element.getDriver();
    stringPromise = element.getInnerHtml();
    element.getLocation().then(function (location: webdriver.ILocation) { });
    stringPromise = element.getOuterHtml();
    element.getSize().then(function (size: webdriver.ISize) { });
    stringPromise = element.getTagName();
    stringPromise = element.getText();
    booleanPromise = element.isDisplayed();
    booleanPromise = element.isEnabled();
    booleanPromise = element.isSelected();
    voidPromise = element.sendKeys('A', 'B', 'C');
    voidPromise = element.sendKeys(1, 2, 3);
    voidPromise = element.sendKeys(webdriver.Key.BACK_SPACE);
    voidPromise = element.sendKeys(stringPromise, stringPromise, stringPromise);
    voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise);
    voidPromise = element.submit();
    element.getId().then(function (id: string) { });
    element.getRawId().then(function (id: string) { });
    element.serialize().then(function (id: webdriver.IWebElementId) { });

    booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId'));
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:46,代码来源:index.ts


示例3: TestWebElement

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

    let element: webdriver.WebElement;

    element = new webdriver.WebElement(driver, 'elementId');

    let voidPromise: Promise<void>;
    let stringPromise: Promise<string>;
    let booleanPromise: Promise<boolean>;

    voidPromise = element.clear();
    voidPromise = element.click();

    element = element.findElement(webdriver.By.id('ABC'));
    element = element.findElement({id: 'ABC'});
    element.findElements({className: 'ABC'}).then((elements: webdriver.WebElement[]) => { });

    stringPromise = element.getAttribute('class');
    stringPromise = element.getCssValue('display');
    driver = element.getDriver();
    element.getLocation().then((location: webdriver.ILocation) => {});
    element.getSize().then((size: webdriver.ISize) => {});
    stringPromise = element.getTagName();
    stringPromise = element.getText();
    booleanPromise = element.isDisplayed();
    booleanPromise = element.isEnabled();
    booleanPromise = element.isSelected();
    voidPromise = element.sendKeys('A', 'B', 'C');
    voidPromise = element.sendKeys(1, 2, 3);
    voidPromise = element.sendKeys(webdriver.Key.BACK_SPACE);
    voidPromise = element.sendKeys(stringPromise, stringPromise, stringPromise);
    voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise);
    voidPromise = element.submit();
    element.getId().then((id: string) => {});
    element.serialize().then((id: webdriver.IWebElementId) => {});

    booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId'));
}
开发者ID:Lavoaster,项目名称:DefinitelyTyped,代码行数:41,代码来源:index.ts


示例4: TestTouchSequence

function TestTouchSequence() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();
    let element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId');

    let sequence: webdriver.TouchSequence = new webdriver.TouchSequence(driver);

    sequence = sequence.tap(element);
    sequence = sequence.doubleTap(element);
    sequence = sequence.longPress(element);
    sequence = sequence.tapAndHold({ x: 100, y: 100 });
    sequence = sequence.move({ x: 100, y: 100 });
    sequence = sequence.release({ x: 100, y: 100 });
    sequence = sequence.scroll({ x: 100, y: 100 });
    sequence = sequence.scrollFromElement(element, { x: 100, y: 100 });
    sequence = sequence.flick({ xspeed: 100, yspeed: 100 });
    sequence = sequence.flickElement(element, { x: 100, y: 100 }, 100);

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


示例5: TestWebElementPromise

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

    var elementPromise: webdriver.WebElementPromise = driver.findElement(webdriver.By.id('id'));

    elementPromise.cancel();
    elementPromise.cancel('reason');

    var bool: boolean = elementPromise.isPending();

    elementPromise.then();
    elementPromise.then(function (element: webdriver.WebElement) { });
    elementPromise.then(function (element: webdriver.WebElement) { }, function (error: any) { });
    elementPromise.then(function (element: webdriver.WebElement) { return 'foo'; }, function (error: any) { }).then(function (result: string) { });

    elementPromise.thenCatch(function (error: any) { }).then(function (value: any) { });

    elementPromise.thenFinally(function () { });
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:21,代码来源:index.ts


示例6: TestWebElementPromise

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

    const elementPromise: webdriver.WebElementPromise = driver.findElement(webdriver.By.id('id'));

    elementPromise.cancel();
    elementPromise.cancel('reason');

    const bool: boolean = elementPromise.isPending();

    elementPromise.then();
    elementPromise.then((element: webdriver.WebElement) => {});
    elementPromise.then((element: webdriver.WebElement) => {}, (error: any) => {});
    elementPromise.then((element: webdriver.WebElement) => 'foo', (error: any) => {}).then((result: string) => {});

    elementPromise.thenCatch((error: any) => {}).then((value: any) => {});

    elementPromise.thenFinally(() => {});
}
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:21,代码来源:index.ts


示例7: 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.setPerfLoggingPrefs({
        enableNetwork: true, enablePage: true, enableTimeline: true,
        tracingCategories: 'category', bufferUsageReportingInterval: 1000 });
    options = options.setUserPreferences('preferences');
}
开发者ID:Lavoaster,项目名称:DefinitelyTyped,代码行数:23,代码来源:chrome.ts


示例8: TestWebDriver

function TestWebDriver() {
    let session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android());
    let httpClient: http.HttpClient = new http.HttpClient('http://someserver');
    let executor: http.Executor = new http.Executor(httpClient);
    let flow: webdriver.promise.ControlFlow = new webdriver.promise.ControlFlow();
    let driver: webdriver.WebDriver = new webdriver.WebDriver(session, executor);
    driver = new webdriver.WebDriver(session, executor, flow);
    driver = new webdriver.WebDriver(sessionPromise, executor);
    driver = new webdriver.WebDriver(sessionPromise, executor, flow);

    let voidPromise: webdriver.promise.Promise<void>;
    let stringPromise: webdriver.promise.Promise<string>;
    let webElementPromise: webdriver.WebElementPromise;

    let actions: webdriver.ActionSequence = driver.actions();
    let touchActions: webdriver.TouchSequence = driver.touchActions();

    // call
    stringPromise = driver.call<string>(() => 'value');
    stringPromise = driver.call<string>(() => stringPromise);
    stringPromise = driver.call<string>(() => 'value', driver);
    stringPromise = driver.call<string>((a: number) => 'value', driver, 1);

    voidPromise = driver.close();
    flow = driver.controlFlow();

    // executeAsyncScript
    stringPromise = driver.executeAsyncScript<string>('function(){}');
    stringPromise = driver.executeAsyncScript<string>('function(){}', 1, 2, 3);
    stringPromise = driver.executeAsyncScript<string>(() => {});
    stringPromise = driver.executeAsyncScript<string>((a: number) => {}, 1);

    // executeScript
    stringPromise = driver.executeScript<string>('function(){}');
    stringPromise = driver.executeScript<string>('function(){}', 1, 2, 3);
    stringPromise = driver.executeScript<string>(() => {});
    stringPromise = driver.executeScript<string>((a: number) => {}, 1);

    // findElement
    let element: webdriver.WebElement;
    element = driver.findElement(webdriver.By.id('ABC'));
    element = driver.findElement(webdriver.By.js('function(){}'));

    // findElements
    driver.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {});
    driver.findElements(webdriver.By.js('function(){}')).then((elements: webdriver.WebElement[]) => {});

    voidPromise = driver.get('http://www.google.com');
    driver.getAllWindowHandles().then((handles: string[]) => {});
    driver.getCapabilities().then((caps: webdriver.Capabilities) => {});
    stringPromise = driver.getCurrentUrl();
    stringPromise = driver.getPageSource();
    driver.getSession().then((session: webdriver.Session) => {});
    stringPromise = driver.getTitle();
    stringPromise = driver.getWindowHandle();

    let options: webdriver.Options = driver.manage();
    let navigation: webdriver.Navigation = driver.navigate();
    let locator: webdriver.TargetLocator = driver.switchTo();

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

    voidPromise = driver.quit();
    voidPromise = driver.schedule<void>(new webdriver.Command(webdriver.CommandName.CLICK), 'ABC');
    voidPromise = driver.sleep(123);
    stringPromise = driver.takeScreenshot();

    booleanPromise = driver.wait(booleanPromise);
    booleanPromise = driver.wait(booleanCondition);
    booleanPromise = driver.wait((driver: webdriver.WebDriver) => true);
    booleanPromise = driver.wait((driver: webdriver.WebDriver) => Promise.resolve(true));
    booleanPromise = driver.wait((driver: webdriver.WebDriver) => webdriver.promise.Promise.resolve(true));
    booleanPromise = driver.wait(booleanPromise, 123);
    booleanPromise = driver.wait(booleanPromise, 123, 'Message');
    webElementPromise = driver.wait(webElementCondition);
    voidPromise = driver.wait(webElementCondition).click();

    driver = webdriver.WebDriver.attachToSession(executor, 'ABC');
    driver = webdriver.WebDriver.createSession(executor, webdriver.Capabilities.android());
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:81,代码来源:index.ts


示例9: TestCapabilities

function TestCapabilities() {
    let capabilities: webdriver.Capabilities = new webdriver.Capabilities();
    capabilities = new webdriver.Capabilities(webdriver.Capabilities.chrome());
    let objCapabilities: any = {};
    objCapabilities[webdriver.Capability.BROWSER_NAME] = webdriver.Browser.PHANTOM_JS;
    capabilities = new webdriver.Capabilities(objCapabilities);

    let anything: any = capabilities.get(webdriver.Capability.SECURE_SSL);
    let check: boolean = capabilities.has(webdriver.Capability.SECURE_SSL);
    capabilities = capabilities.merge(capabilities);
    capabilities = capabilities.merge(objCapabilities);
    capabilities = capabilities.set(webdriver.Capability.VERSION, { abc: 'def' });
    capabilities = capabilities.set(webdriver.Capability.VERSION, null);
    capabilities = capabilities.setLoggingPrefs(new webdriver.logging.Preferences());
    capabilities = capabilities.setLoggingPrefs({ key: 'value' });
    capabilities = capabilities.setProxy({ proxyType: 'Type' });
    capabilities = capabilities.setEnableNativeEvents(true);
    capabilities = capabilities.setScrollBehavior(1);
    capabilities = capabilities.setAlertBehavior('accept');

    anything = capabilities.toJSON();

    capabilities = webdriver.Capabilities.android();
    capabilities = webdriver.Capabilities.chrome();
    capabilities = webdriver.Capabilities.firefox();
    capabilities = webdriver.Capabilities.htmlunit();
    capabilities = webdriver.Capabilities.htmlunitwithjs();
    capabilities = webdriver.Capabilities.ie();
    capabilities = webdriver.Capabilities.ipad();
    capabilities = webdriver.Capabilities.iphone();
    capabilities = webdriver.Capabilities.opera();
    capabilities = webdriver.Capabilities.phantomjs();
    capabilities = webdriver.Capabilities.safari();
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:34,代码来源:index.ts


示例10:

import 'babel-core/register';
import 'babel-polyfill';

import * as webdriver from 'selenium-webdriver';

import {chromedriver} from 'selenium-binaries';
process.env.CHROME_DRIVER_PATH = chromedriver;

export const driver = new webdriver.Builder()
    .withCapabilities(webdriver.Capabilities.chrome())
    .build();

开发者ID:kerbyfc,项目名称:cucumber-tsflow-suite,代码行数:11,代码来源:driver.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript selenium-webdriver.Command类代码示例发布时间:2022-05-25
下一篇:
TypeScript selenium-webdriver.By类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap