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


TypeScript WebElement.getAttribute方法代码示例

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


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

示例1: 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

示例2: 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


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