How to set focus on a section of my web page then scroll down
10,416
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);
You can have a look at the webdriverjs doc.
Author by
Ziwdigforbugs
Updated on July 29, 2022Comments
-
Ziwdigforbugs almost 2 years
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>
-
flaviomeira10 over 8 yearsIt is not working for me due to this issue (github.com/angular/protractor/issues/1846), even though it is a good approach
-
DrZoo over 8 yearsThis worked for me in Protractor v2.5.1. Thanks a million!