使用量角器我想首先将焦点设置在网页的左侧面板上,然后向下滚动以单击过滤器.知道如何使用量角器语法来做到这一点吗?这是我的 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 文档.
这篇关于如何将焦点设置在我网页的某个部分然后向下滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!