问题描述
我正在 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"属性.
我读了一个类似的问题(此处)但对我的情况没有帮助.
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.
推荐答案
它不是 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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!