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


TypeScript ElementFinder.getAttribute方法代碼示例

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


在下文中一共展示了ElementFinder.getAttribute方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getBodyScrollHeight

  getBodyScrollHeight(): promise.Promise<number> {
    const body: ElementFinder = element(by.css('body'));

    return body.getAttribute('scrollHeight').then((bodyScrollHeightString: string) => {
      return +bodyScrollHeightString;
    });
  }
開發者ID:Nolanus,項目名稱:ng2-page-scroll,代碼行數:7,代碼來源:app.po.ts

示例2: it

    it('should select value and close dropdown', async () => {
        select.element(by.css('.ng-select-container')).click();
        select.all(by.css('.ng-option')).first().click();

        expect(select.getAttribute('class')).not.toMatch('ng-select-opened');
        const text = await element(by.id('ngModel')).getText();
        expect(text).toEqual('1');
    });
開發者ID:fawzaar,項目名稱:ng-select,代碼行數:8,代碼來源:app.e2e-spec.ts

示例3: check

export function check(el: ElementFinder) {
    Util.waitUntilElementIsVisible(el);
    el.getAttribute('class').then((classList) => {
        if (classList && classList.indexOf('mat-checked') === -1) {
            el.click();
            expect(el.getAttribute('class')).toContain('mat-checked');
        }
    });
}
開發者ID:Alfresco,項目名稱:alfresco-ng2-components,代碼行數:9,代碼來源:material.ts

示例4: changeInputValue

 public static changeInputValue(elemFinder: ElementFinder, fieldName: string, viewModel: any, backupModel?: any) {
     elemFinder.getAttribute('value').then((value: string) => {
         if (backupModel) {
             backupModel[fieldName] = value;
         }
         elemFinder.clear();
         elemFinder.sendKeys(viewModel[fieldName]);
         console.log('Change value for ' + fieldName + ' from "' + value + '" to "' + viewModel[fieldName] + '"');
     });
 }
開發者ID:GeoscienceAustralia,項目名稱:gnss-site-manager,代碼行數:10,代碼來源:test.utils.ts

示例5: appendTimestamp

 public static appendTimestamp(elemFinder: ElementFinder, timestamp: string) {
     elemFinder.getAttribute('value').then((value: string) => {
         let index: number = value.indexOf('@');
         if(index > 0) {
             value = value.substring(0, index);
         }
         elemFinder.clear();
         elemFinder.sendKeys(value + timestamp);
     });
 }
開發者ID:GeoscienceAustralia,項目名稱:gnss-site-manager,代碼行數:10,代碼來源:test.utils.ts

示例6: getElementAttribute

 async getElementAttribute(xpath:string, attribute:string):Promise<string>{
     var ele:ElementFinder = await this.curBrowser.element(by.xpath(xpath))
     var attributeValue:string =""
     await this.curBrowser.wait(this.until.presenceOf(ele), this.timeOut, 'Element ' + xpath + ' takes too long to appear in the DOM' )
     
     await ele.getAttribute(attribute).then(function(value){
         console.log("Attribute value: " + value)
         attributeValue = value
     })
     return attributeValue
 }
開發者ID:AnhPhamIT,項目名稱:Protractor,代碼行數:11,代碼來源:actionSupport.ts

示例7: checkInputValueEqual

 public static checkInputValueEqual(elemFinder: ElementFinder, elemName: string, expectValue: string | number) {
     elemFinder.getAttribute('value').then((value: string) => {
         if(typeof expectValue === 'number') {
             expect(value).toEqual(expectValue.toString());
             console.log('Check if ' + elemName + ' is "' + value + '": ' + (expectValue.toString() === value));
         } else {
             expect(value).toEqual(expectValue);
             console.log('Check if ' + elemName + ' is "' + value + '": ' + (expectValue === value));
         }
     });
 }
開發者ID:GeoscienceAustralia,項目名稱:gnss-site-manager,代碼行數:11,代碼來源:test.utils.ts

示例8: return

 return (target, propertyKey): PropertyDescriptor => {
     return {
         get() {
             return elem.getAttribute('value');
         },
         set(input) {
             elem.clear();
             elem.sendKeys(input);
         },
     };
 };
開發者ID:Droogans,項目名稱:encore-ui,代碼行數:11,代碼來源:textField.page.ts

示例9: it

 it('should populate the form control values in the DOM', () => {
   expect(firstInput.getAttribute('value')).toEqual('Nancy');
   expect(lastInput.getAttribute('value')).toEqual('Drew');
 });
開發者ID:AlmogShaul,項目名稱:angular,代碼行數:4,代碼來源:simple_form_group_spec.ts

示例10: it

 it('should set the value by changing the domain model', () => {
   button.click();
   expect(input.getAttribute('value')).toEqual('Nancy');
 });
開發者ID:Cammisuli,項目名稱:angular,代碼行數:4,代碼來源:simple_ng_model_spec.ts


注:本文中的protractor.ElementFinder.getAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。