gemini icon indicating copy to clipboard operation
gemini copied to clipboard

Possibility to capture element if it's hidden during page load

Open apsavin opened this issue 9 years ago • 12 comments

My config:

 gemini.suite('popup ' , function (child) {
            child
                .setUrl('url/to/page')
                .before(function (actions, find) {
                    actions.setWindowSize(1200, 800);
                    actions.click(find('.show-popup'));
                    actions.waitForElementToShow('.popup', 2000);
                })
                .setCaptureElements('.popup')
                .capture('plain');
        });

result:

StateError: Area with css selector : .popup is hidden

expected behavior:

captured popup.

apsavin avatar Dec 08 '15 16:12 apsavin

Do you really need to change your window size from the test, not from the config? And more correctly to do some action in this way:

gemini.suite('popup' , function (child) {
    child
        .setUrl('url/to/page')
        .setCaptureElements('.popup')
        .capture('plain', function(actions) {
            actions
                .click('.show-popup')
                .waitForElementToShow('.popup', 2000);
        });
});

Also, to capture popup with some element you can wrap them with some extra div and set it as captureElement

sipayRT avatar Dec 10 '15 20:12 sipayRT

Thanks for the response! I tried your snippet, but result is the same: StateError: Area with css selector : .popup is hidden It's because popup is hidden during page load, I suppose. Feels like a bug.

apsavin avatar Dec 16 '15 11:12 apsavin

I'm not sure but it seems like I have this bug too. The test below is doesn't work:

gemini.suite('test-name', function(suite) {
    suite.setUrl('test-url')
        .setCaptureElements('[data-ix=eventappear]')
        .capture('plain', function(actions) {
            actions.waitForElementToShow('[data-ix=eventappear]', 30000);
        });
});

Result is Area with css selector : [data-ix=eventappear] is hidden. And it appears after 5-7 seconds of running gemini update.

But the next test suite works fine:

gemini.suite('test-name', function(suite) {
    suite.setUrl('test-url')
        .before(function(actions) {
            actions.wait(30000);
        })
        .setCaptureElements('[data-ix=eventappear]')
        .capture('plain');
});

igoradamenko avatar Sep 07 '16 23:09 igoradamenko

Can you provide your page for testing (also we need info for your environment)? I can't reproduce your problem. waitForElementToShow method will wait for showing of your selector exactly for timeout period specified in argument.

sipayRT avatar Sep 08 '16 08:09 sipayRT

@sipayRT

Env: OS X 10.11.6, node v.4.5.0, npm v.2.15.9 Gemini: v.4.11.0 PhantomJS: v.2.1.12

.gemini.yml:

rootUrl: http://dev2dev.ru/
browsers:
  PhantomJS:
    compositeImage: true
    desiredCapabilities:
      browserName: phantomjs

test.js:

gemini.suite('dev2dev', function(suite) {
    suite.setUrl('/')
        .setCaptureElements('[data-ix="eventappear"]')
        .capture('plain', function(actions) {
            actions.waitForElementToShow('[data-ix="eventappear"]', 30000)
        });
});

Console log:

 ~/Projects/test$ gemini update
WARNING
Running local gemini from /Users/dante/Projects/test/node_modules/gemini
Version: 4.11.0
Global: 4.9.0

✘ dev2dev plain [PhantomJS]
Area with css selector : [data-ix="eventappear"] is hidden
Total: 1 Passed: 0 Failed: 1 Skipped: 0 Retries: 0

It looks strange that error is about invisibility of element, but there is no info like not shown after 30000ms.

igoradamenko avatar Sep 24 '16 09:09 igoradamenko

@tormozz48 ☝️

sipayRT avatar Sep 27 '16 06:09 sipayRT

@apsavin I have reproduced your case on my localhost.

tormozz48 avatar Sep 27 '16 15:09 tormozz48

Hi all. Any solution to this problem?

GRboss avatar Jul 13 '17 08:07 GRboss

Is there any workaround for this issue? Having it as well

artemyarulin avatar Jan 29 '18 12:01 artemyarulin

☝️ Also having this problem.. =\

xcxooxl avatar Feb 22 '18 13:02 xcxooxl

Can you provide some minimal-case html page to test? I've tried many different combinations of how element should appear and still can't reproduce this error locally.

Dmitriy-kiselyov avatar Mar 29 '18 16:03 Dmitriy-kiselyov

Same issue I am facing . Area with css selector : .headerimage-component is hidden Total: 1 Passed: 0 Failed: 1 Skipped: 0 Retries: 0

Any work around for this. ?

anuraggautam77 avatar Jun 07 '18 10:06 anuraggautam77