當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript WebElement.getText方法代碼示例

本文整理匯總了TypeScript中selenium-webdriver.WebElement.getText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript WebElement.getText方法的具體用法?TypeScript WebElement.getText怎麽用?TypeScript WebElement.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在selenium-webdriver.WebElement的用法示例。


在下文中一共展示了WebElement.getText方法的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.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。