当前位置: 首页>>代码示例>>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;未经允许,请勿转载。