"未定义不是函数“;在.to Be功能
"Undefined is not a function" at .toBe fucntion
我正在编写一个测试来自动化一个场景,使用PROTRACTOR:
我在得到"未定义不是函数"。下面是我的代码:试图获得元素的偏移位置:
this.Then(/^I should have ONLY LOGO available on main page$/, function () {
element(by.id('mainPage')).getLocation().then(function (navDivLocation) {
var currTop = navDivLocation.y;
var currLeft = navDivLocation.x;
expect(currLeft).toBe(0);
expect(currTop).toBe(0);
});
});
黄瓜和茉莉是互斥的。
如果您还没有,您应该使用Chai
断言库:
expect(currLeft).to.equal(0);
expect(currTop).to.equal(0);
要断言不同Protractor
函数返回的promise,请使用Chai-as-promised
库——您可以在expect()
中传递promise。示例:
expect(elm.getText()).should.eventually.equal("my text");
相关文章:
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- jQuery AJAX write to XML
- grep in JQuery to C#
- how to convert html <div> to pdf
- Node.js - POST to iFrame?
- SVG xml to image
- Advantages to DOMParser vs template & innerHTML
- how to split a string with ','
- How to declare a Map containing certain properties with flow
- Php variable obj to js
- 如何在submit to sightly时将表单输入值作为参数传递给WCMUsePojo
- D3JS selectAll to append rect
- Javascript connect to websocket
- Underscore each to update collection
- 在哪里可以找到R-to-JavaScript编译器
- SCEditor BBcode to HTML parsing
- Javascript RegEx to XML Schema RegEx
- express.JS .push cousing array to be undefined
- "未定义不是函数“;在.to Be功能
- .sports-changed-status should be changed to .sports-last-sec