类型“typeof protractor"上不存在“ExpectedConditions" [英] 'ExpectedConditions' does not exist on type 'typeof protractor'

查看:40
本文介绍了类型“typeof protractor"上不存在“ExpectedConditions"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Visual Studio 2013 中的 TypeScript 中编写量角器测试,但出现错误:

I'm writing a protractor test in TypeScript in Visual Studio 2013 and I'm getting the error:

typeof protractor"类型不存在ExpectedConditions"属性.

Property 'ExpectedConditions' does not exist on type 'typeof protractor'.

我读了一个类似的问题(此处)但对我的情况没有帮助.

I read a similar question (here) but it did not help my situation.

这是我的页面对象代码:

This is my page objects code:

class SheetObjects {
    EC = protractor.ExpectedConditions;
    showList = element(by.buttonText('Show as List'));
    copyItem = element.all(by.binding('item.name')).get(2);
    copyDiv = element(by.className('md-inline-list-icon-label'));
    alertItem = element(by.binding('alert'));
    alertDiv = element(by.css('[ng-if="alert"]'))

    NavigateToPage() {
        browser.get('https://material.angularjs.org/latest/#/demo/material.components.bottomSheet');
    }

    WaitForElements(element: any) {
        browser.wait(() => element.isPresent(), 5000);
    }

    ClickOn(element: any) {
        element.click();
    }
}
module.exports = new SheetObjects();

这是我的packages.config:

This is my packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="angular-protractor.TypeScript.DefinitelyTyped" version="2.1.1" targetFramework="net45" />
  <package id="jasmine.TypeScript.DefinitelyTyped" version="1.3.4" targetFramework="net45" />
  <package id="node.TypeScript.DefinitelyTyped" version="1.5.6" targetFramework="net45" />
  <package id="Protractor" version="0.5.0" targetFramework="net45" />
  <package id="Selenium.WebDriver" version="2.45.0" targetFramework="net45" />
  <package id="selenium-webdriver.TypeScript.DefinitelyTyped" version="0.3.7" targetFramework="net45" />
</packages>

我认为 ExpectedConditions 将包含在其中一个软件包中,但到目前为止还没有修复它.

I figured ExpectedConditions would be included in one of those packages but so far nothing has fixed it.

推荐答案

我认为 ExpectedConditions 将包含在其中一个软件包中,但到目前为止还没有修复它.

I figured ExpectedConditions would be included in one of those packages but so far nothing has fixed it.

它不是 https://github.com/borisyankov/DefinitelyTyped/search?utf8=%E2%9C%93&q=ExpectedConditions 这意味着该定义与当前的实际有点过时em> 量角器代码:http://angular.github.io/protractor/#/api?view=ExpectedConditions

its not https://github.com/borisyankov/DefinitelyTyped/search?utf8=%E2%9C%93&q=ExpectedConditions This implies that the definition is a bit out of date with the current actual protractor code : http://angular.github.io/protractor/#/api?view=ExpectedConditions

只需以无类型的方式使用它:

Just use it in an untyped manner:

EC = (<any>protractor).ExpectedConditions;

这篇关于类型“typeof protractor"上不存在“ExpectedConditions"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆