量角器 - 向下滚动并单击 [英] Protractor - Scroll down and click

查看:60
本文介绍了量角器 - 向下滚动并单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想简单地在表格中向下滚动并单击元素.

I'm trying to simply scroll down in table and click on the element.

这是我拥有的功能:

    var scrollIntoView = function () {
        arguments[0].scrollIntoView();
    }

    element.all(by.css('div.ui-grid-selection-row-header-buttons')).then(function(arr) { 
    var row = arr[8]; 
    browser.executeScript(scrollIntoView, row.getWebElement()).then(function () { 
    row.click(); 
    }); 
    });

这个脚本实际上可以工作,甚至向下滚动,当我在 arr[] 中使用更高的数字(索引)时,问题就开始了;

This script actually work and even scroll down, bproblem start when i use higher number (index) in arr[];

例如 8 个有效,但如果我使用 20 个则无效,而且我很确定那里有 50 个值,因此存在问题.

For example 8 work, but if i use 20 it don't and I'm pretty sure there are like 50 values there so problem in that.

任何提示都会有所帮助

推荐答案

如果你想滚动到一个元素,你可以使用

If you want to scroll to an element you can use

    browser.actions().mouseMove(element).perform();

之后浏览器将聚焦元素.

After that the browser will be focusing the element.

这篇关于量角器 - 向下滚动并单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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