gemini-testing / gemini

💀💀💀[DEPRECATED] Use hermione
https://github.com/gemini-testing/hermione
MIT License
1.5k stars 149 forks source link

Is that possible to use screenshotMode: fullpage on ChromeDriver? #557

Open thybzi opened 8 years ago

thybzi commented 8 years ago

Trying to use Gemini via ChromeDriver for mobile emulation testing I want to get full page screenshot

My current settings are the following:

browsers:
  mobile-320:
    desiredCapabilities:
      browserName: chrome
      chromeOptions:
        mobileEmulation:
          userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4'
          deviceMetrics:
            width: 320
            height: 6000
            pixelRatio: 1

This variant doesn't fail, though makes screenshots not 6000px high, but my available screen area high

I tried adding screenshotMode: fullpage, which doesn't have any effect.

Combining screenshotMode: fullpage with height: 568 (instead of 6000) leads to out of bounds exception.

Any idea how to make this work (and make fullscreen mobile screenshot)?

thybzi commented 8 years ago

I am capturing body element (html produces the same error)

Exception I'm getting:

StateError: Can not capture the specified region of the viewport.
            The region bottom bound is outside of the viewport height.
            Alternatively, you can test such cases by setting "true" value to option "compositeImage" in the config file.
            Element position: 0, 0; size: 320, 1611.
            Viewport size: 320, 568.

Setting compositeImage: true makes header with position fixed to duplicate on multiple positions, which is not good.

sipayRT commented 8 years ago

in your case you can change position: fixed to position: static with executeJS to capture all body. But what state you need to check?

thybzi commented 8 years ago

I just want to capture the full page without header doubling :)

thybzi commented 8 years ago

Thanks for executeJS hack

But the true question is in issue's title:

Is that possible to use screenshotMode: fullpage on ChromeDriver?

sipayRT commented 8 years ago

option screenshotMode is about working with page, it's not mean that you can get screenshot of the full page. To capture block that biggest than viewport sizes you should use compositeImage option

thybzi commented 8 years ago

UPD. "Out of bounds" exception is thrown even with both screenshotMode: fullpage and compositeImage: true set at the same time, if I use ChromeDriver.

When using PhantomJS with the same options enabled, no such error is produced.

Reproduced on Windows 10, but if you want, I'll try to reproduce on MacOSX/Ubuntu systems, too

sipayRT commented 8 years ago

"Out of bounds" exception is thrown even with both screenshotMode: fullpage and compositeImage: true set at the same time, if I use ChromeDriver.

Can you show your screen sizes and Chrome version on which I can reproduce that behavior?

thybzi commented 8 years ago

Real screen size: 1920×1080 Gemini config screen size: 320×578 (set via deviceMetrics, or windowSize, or both) Chrome version: 52.0.2743.116 m ChromeDriver version: 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) Gemini version: 4.6.0 Windows version: Windows 10 x64, version 1511, build 10586.545

sipayRT commented 8 years ago

https://github.com/gemini-testing/gemini/pull/592

thybzi commented 8 years ago

You mean it's fixed in #592?

sipayRT commented 8 years ago

it's about out of the bound only. Your case with fixed header can't be fixed by gemini

thybzi commented 8 years ago

Ok, I'll retest the issue with fresh version of gemini

lo1tuma commented 7 years ago

I’ve exactly the same issues as @thybzi described.

I’m using gemini v4.12.0 and still get the Out of bounds exception. Seems like #592 did not fix this problem. I’ve added some console.log statements here in order to see the actual numbers, here is what I got:

safeRect.left 0
safeRect.top 1136
safeRect.width 320
safeRect.height -304
imageSize.height 832
imageSize.width 1440
rect.width 320
rect.height 568
rect.top 1136
rect.left 0

As you can see safeRect.height is a negative number which probably causes the problem.

For my test case I have set screenshotMode to fullpage and compositeImage to true. I haven’t set window sizes explicitly but I’m also using the mobileEmulation feature of chromeDriver with the Apple iPhone 5 preset.

"desiredCapabilities": {
  "chromeOptions": { "mobileEmulation": { "deviceName": "Apple iPhone 5" } }
}

I’m testing against chrome 53.0 on Windows 10 with a native screen resolution of 1440x900 (via saucelabs). I’m capturing the body element.

sipayRT commented 7 years ago

@lo1tuma can you provide test and page for testing to reproduce your problem?

lo1tuma commented 7 years ago

@sipayRT sure, I pushed a reproducible test case here: https://github.com/lo1tuma/gemini-issue-557

sipayRT commented 7 years ago

@eGavr ⬆️ tvoj lubimij "out of the bounds" :)

eGavr commented 7 years ago

@sipayRT , кажется, что для out of the bounds стоит завести отдельный issue, нет?

pftg commented 7 years ago

Will be great to fix this and out of the bounds issues. Any updates here?

mchennig commented 5 years ago

Currently having the same Problem with current versions of Chrome, Selenium and Gemini. Maybe this is related to Chromedriver Issue 294?

masi commented 5 years ago

Having the same issues.

But actually I'm luvky when I get "out of bounds". I've been experiencing all kinds of issues includung various failures to "inject" (?) Gemini code into th page etc.