Protractor - Scroll down and click

Related searches

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

This is function which I have:

    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(); 
    }); 
    });

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

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.

Any hint will help guys

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.

Scroll down to an element with protractor, i think this is helpful to you: dvr.executeScript('window.scrollTo(94,188);').then( function() { element(by.<<here your button locator>>).click(); }). There is a button on my page which becomes visible when the user scrolls down. As a result, protractor tests give me an error: UnknownError: unknown error: Element is not clickable at point (94, 188). I tried this code: browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); This actually worked in my protractor tests

This tested example demonstrate how to scroll to an element using javascript and click the same element .

it('scroll to element', function() {
       browser.driver.get('https://www.seleniumeasy.com/');
        var btnSubscribe= element(by.id('mc-embedded-subscribe'));
         browser.executeScript("arguments[0].scrollIntoView();", btnSubscribe);
         browser.sleep(2500);
         btnSubscribe.click();
      });

Protractor: Scroll down, You need to wait for the scrolling to complete before any click works. Try this: browser.executeScript('window.scrollTo(0,0);').then(function () {. row.click(); This script actually work and even scroll down, bproblem start when i use higher number (index) in arr[]; 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.

You can actually do something like this:

$$('div.ui-grid-selection-row-header-buttons').each(function (ele) {
    browser.actions().mouseMove(ele).click().perform();
});

$$ actually represents element.all(by.css('.abc'))

Also you can use filter() if you don't want to click on all the elements but pick elements based on filter criteria like this: https://www.protractortest.org/#/api?view=ElementArrayFinder.prototype.filter

Scrolling down in Protractor, You need to wait for the scrolling to complete before any click works. Try this: browser.executeScript('window.scrollTo(0,0);').then(function´┐Ż Mouse Actions in Protractor, Mouse actions are nothing but the simulating the mouse actions like double click, drag and drop, keyboard pressing, right click and left click, how to hover an element in protractor

How to scroll up and down in Protractor?, I have a scroll bar inside Window. The CSS of my scroll is '.scrollable'. I want to scroll up until () { }) Does anyone know how to solve this? Protractor - Scroll down and click. 0. Protractor/XPath - Find element that contains a descendant that contains text. 4. Protractor: Testing window scroll behavior. 1.

To rotate the scale or protractor, keep the mouse pointer over it and then use the middle button of your mouse to change its angle. For touchpad users, again, rest the mouse pointer over it and

Protractor: In this tutorial, we would be learning about handling javascript alerts, confirmation boxes and prompts. We will also learn about hodden division popUps, Models, and authentcation pop-ups, finally file upload popups

Comments
  • maybe this post helps: stackoverflow.com/questions/23571852/protractor-scroll-down/…. the snippet shows the use of window.scrollTo(0,0); instead of scollIntoView (which currently only is supportet by firefox 36 and is experimental)