protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Implement elementNotToBeCovered for ExpectedConditions library

Open hankduan opened this issue 9 years ago • 49 comments

See https://github.com/angular/protractor/issues/2139

hankduan avatar Jul 07 '15 18:07 hankduan

Really need this. It would solve a big problem

psg99001 avatar Oct 23 '15 06:10 psg99001

This is exaclty our issue in globaleaks dealing with application loader and asyncronous operations.

evilaliv3 avatar Jan 26 '16 18:01 evilaliv3

+1

jlin412 avatar May 07 '16 10:05 jlin412

Really need this for pop ups and overlays that appear on top of the page, the ExpectedConditions.elementToBeClickable does not help in this case...

Paulyte avatar Jul 01 '16 10:07 Paulyte

Yes this! I am constantly running into "Element is not clickable at point (x,y). Other element would receive the click:" errors after scrolling and trying to click an element.. but only like ~14% of the time.. frustrating. Even waiting for elementVisible or elementToBeClickable doesn't always work.

smearedyam avatar Aug 09 '16 16:08 smearedyam

+1

wlsf82 avatar Aug 10 '16 08:08 wlsf82

+1

stheikki avatar Aug 11 '16 05:08 stheikki

+1

RepoCorp avatar Aug 17 '16 20:08 RepoCorp

I'd like to see this functionality released ASAP. This issue is so annoying. Is there any workaround for it?

simplyageek avatar Aug 30 '16 14:08 simplyageek

+1

bobbyg603 avatar Sep 30 '16 17:09 bobbyg603

+1

terodox avatar Sep 30 '16 17:09 terodox

+1

danieljin avatar Sep 30 '16 17:09 danieljin

+1

spedy avatar Oct 03 '16 11:10 spedy

@sjelin you mention that this could be done in another thread, right?

We would address this using document.elementFromPoint and element.getBoundingClientRect pretty easily actually. elementFromPoint isn't totally standard at this point, though it appears to be supported by all browsers. The consistency issue is real though. Donno if we should leave this the way it is or "fix" it

jlin412 avatar Oct 04 '16 13:10 jlin412

+1000000000

latobibor avatar Oct 06 '16 12:10 latobibor

+999

Nicolai82 avatar Oct 10 '16 12:10 Nicolai82

+2000000

avijayanadha avatar Nov 04 '16 10:11 avijayanadha

+2000000

avijayanadha avatar Nov 04 '16 10:11 avijayanadha

+999

anujchandran avatar Nov 04 '16 10:11 anujchandran

+1

bryceeller2 avatar Nov 04 '16 22:11 bryceeller2

+1

magleahy avatar Nov 10 '16 15:11 magleahy

+1

Nuri7 avatar Dec 14 '16 17:12 Nuri7

+1 EDIT: Sorry then. I've seen it as pretty common practice elsewhere to vote on issues with a +1 and this is a problem I've run a lot writing protractor tests so I'd be interested in seeing it implemented. I'll remember that for the future though.

connordodge avatar Jan 05 '17 17:01 connordodge

Please stop +{number} this PR. This doesn't help...

cnishina avatar Jan 05 '17 19:01 cnishina

Any update on this? For my use case, I'm using the following to scroll the element into view, but I know this isn't a solution for all use cases such as modals and such.

var el = $('.myElement');
browser.executeScript('arguments[0].scrollIntoView()', el.getWebElement());

davidwickman avatar Mar 10 '17 22:03 davidwickman

We've developed a workaround for now. We identify the element (id="spinner") that is "blocking" the element that we actually want to click and simply just wait for the blocking element to be invisible like so: broswer.wait(EC.invisibilityOf($(‘#spinner’)), 5000)

kseans8 avatar Mar 21 '17 15:03 kseans8

EC.invisibilityOf isn't always enough. Sometimes Protractor reports an element as being covered by another element that shouldn't be invisible.

For instance, in one of my tests, a link is reported as being covered by its parent div, and invisibilityOf will wait forever. Seconding the desire for toNotBeCoveredBy

ditkin avatar Apr 21 '17 18:04 ditkin

This issue is 2 years old. Is there any solution for this already, because I cannot find it and I am still encountering this problem? In my situation I cannot wait for element to be invisible, because the covering element is not going to be invisible at any point and it is not visually covering the element, but I still get the error for not clickable at point, because another element would receive the click.

+1 for the "toNotBeCoveredBy"

MihailSeykov avatar Jul 28 '17 09:07 MihailSeykov

I have solved such issue in one case with the following:

"use strict";

function elementWithAttributeHasNotValue(htmlElement, attribute, value) {
    return htmlElement.getAttribute(attribute).then((elementAttribute) => {
        return !elementAttribute.includes(value);
    });
}

class Helper {
    waitForAngularInRoomAnimationToBeDone() {
        const inRoomElement = element(by.className("in-room"));

        browser.wait(elementWithAttributeHasNotValue(inRoomElement, "class", "ng-animate"), browser.params.DEFAULT_TIMEOUT_MS);
    }
}

module.exports = Helper;

The name of the method and of the constant are specific from my use case, but I think the rest could be used in a more generic way.

Then in my test I use it like this:

helper.waitForAngularInRoomAnimationToBeDone();

wlsf82 avatar Jul 28 '17 09:07 wlsf82

The thing is that in my situation, when I look at the screenshot of the error, which is capturing the state of the browser screen at the moment of the error, everything looks fine and the element I want to click is visible, but Protractor is still reporting that the element is not clickable, because another would receive the click and waiting for element to be visible or enabled doesn't work as the element is already visible on the screen and is enabled. I have this issue in Chrome and it is not appearing every time, only like 20% of the time. I tried the code above, but it does not work for me.

MihailSeykov avatar Jul 28 '17 09:07 MihailSeykov