Edg*_*nez 6 javascript angularjs-e2e protractor
我正在尝试确保在单击某个跨度时页面滚动到元素.所以我需要检查元素的y位置.有人可以解释我如何获得元素的位置吗?
element.all(by.css('[scroll-to="section-executive-summary-anchor"]'))
.then(function (elem) {
elem[0].click().then(function () {
element(by.id('section-executive-summary-anchor'))
.then(function (el) {
// I need "el.position" or something along those lines
});
});
});
Run Code Online (Sandbox Code Playgroud)
你可以使用getLocation()功能:
element(by.id('section-executive-summary-anchor')).getLocation().then(function (location) {
expect(location.y).toEqual(100);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7247 次 |
| 最近记录: |