mardi 21 juin 2016

protractor and tricky accordion

I have to select an element in what appears to be a pop up window, but in real live it is an accordion. I using the following approach, which is working:

var accordion = element(by.id('promoAccordion'));

var promoChannels = element.all(by.repeater('channelCreatives in creativesByChannel'));

var firstPromoChannel = element.all(by.repeater('channelCreatives in creativesByChannel')).first();

later on:

this.activatePromotions = function() {

expect((accordion).isPresent()).toBe(true);

expect(promoChannels.count()).toBeGreaterThan(1);

firstPromoChannel.click();

Now, I need to scroll down to "Send Changes" button and click on it. This button is defined as

var sendChangesButton = element(by.buttonText('Send Changes'));

The problem is that once I clicked on firstPromoChannel, it resulted appearance of the second vertical scroll bar (as content in accordion does not fit in the page). When I am trying

expect((accordion).isPresent()).toBe(true);

browser.executeScript('window.scrollBy(0,450);');

it actually scrolls down the original window which doesn't help me to get the button in view. there is no way to switch via browser.switchTo() or browser.selectWindow(); as this is an accordion and not a new window.

How could I scroll down within this accordion to get the button in view?

Aucun commentaire:

Enregistrer un commentaire