请帮助我,我无法使用垂直和垂直滑动动作进行滚动 我试过了,例如垂直滑动的示例,它不起作用:
browser.actions ()
.mouseDown (element (by.css ('. filter-editorial-rating .ngrs-handle-max')))
.mouseMove ({x: 0, y: 50}) // value of Y how many pixels from above are shifted when scrolling
.mouseUp ()
.perform ();
有必要在滑动的帮助下滚动,以使其看起来像是人类的动作。
我也尝试过
browser.controlFlow (). execute (function () {
browser.executeScript ('arguments [0] .scrollIntoView ({behavior: "smooth"})',
linkfound3.getWebElement ());
});
它是可行的,但是它只是滚动而不模仿屏幕
例如,水龙头看起来像真实动作,例如:
browser.actions (). mouseMove (burger_link) .click (). perform ();
// it work as human
也许我应该使用浏览器,动作和水龙头进行垂直滑动,但是我不知道该怎么做。
如何在量角器中进行逼真的人为滑动? 请帮助或至少直接
更新:
我找到了我所需要的!这是
var startLocation = {
x: 0,
y: 50
}
var newLocation = {
x: 0,
y: 1000
};
browser.touchActions()
.tapAndHold(startLocation)
.move(newLocation)
.perform();
但是muve()函数将光标移动得太快。如何调整速度?
答案 0 :(得分:0)
尝试以下选项
Var bottomPageEle = locator from bottom of the page.
现在要垂直滚动,请使用Java脚本执行程序来使用scrollIntoView
选项,如下所示:
await browser.executeScript("arguments[0].scrollIntoView(true);", bottomPageEle);
await browser.sleep(3000);
上述js执行器将执行垂直滚动。
希望它对您有帮助