How to set focus on a section of my web page then scroll down(如何将焦点设置在我网页的某个部分然后向下滚动)
问题描述
使用量角器我想首先将焦点设置在网页的左侧面板上,然后向下滚动以单击过滤器.知道如何使用量角器语法来做到这一点吗?这是我的 HTML:
using protractor I would like to first set focus on a left pannel in my web page then scroll down in order to click on a filter. Any idea how to do this using protractor syntax? Here is my HTML :
<section id="filters" style="height: 266px; overflow: hidden;" tabindex=
"5076">
<div class="ng-binding" id="currentSearchTitle">
Current search
</div>
<div id="currentSearch">
<div id="searchBlock">
<div id="jobTypeBlock">
<div class="ng-binding" id="jobTypeTitle">
Filter by job type
</div>
<div class="ng-scope">
<div class="ng-scope">
<div class="ng-scope">
<div class="ng-scope">
<div class="ng-scope">
<div class="ng-scope">
<div class="ng-scope"></div>
推荐答案
要在面板上设置焦点,您可以单击它:
To set the focus on your panel you can maybe click on it:
element(by.id('filters')).click();
然后滚动到您的过滤器,您可以执行客户端脚本:
Then to scroll to your filter, you can execute a client side script:
var filter = browser.findElement(by.id('jobTypeTitle'));
var scrollIntoView = function () {
arguments[0].scrollIntoView();
};
browser.executeScript(scrollIntoView, filter);
您可以查看 webdriverjs 文档.
这篇关于如何将焦点设置在我网页的某个部分然后向下滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将焦点设置在我网页的某个部分然后向下滚动
基础教程推荐
- fetch 是否支持原生多文件上传? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
