selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

Spurious truncated screenshots with IEDriver on Win7 IE10 / IE11 (at least 64bit) with Selenium 2.44

Open lukeis opened this issue 8 years ago • 7 comments

Originally reported on Google Code with ID 8488

Dear developers, 

we have some strange/annoying problems with IEDriver on Win7 / Win8 and IE 10 / IE
11.
The machines are 64bit as well as the used IEDriverServer executables. The (virtual)
hardware is kind of low-performance. Debugging was performed using Selenium 2.44.04
(which is not the most up-to-date version but more recent versions on our production
servers did not give better results).

I have checked that we have all registry values properly set as described at https://code.google.com/p/selenium/wiki/InternetExplorerDriver

I have an artificial test script that does the following:

1) get() a web page (for this I have created a very simple page with a div with height
3000px)
2) sleep 20 seconds
3) create a screenshot

Sometimes (in about 50% of all cases) the screenshots are truncated at the viewport
boundaries.
These 50% of cases appear clustered, i.e. if it happens, it happens every time for
a while, if it does not
happen, everything is fine for a while. Sometimes, the problem disappears for a while
when the machine is rebooted, sometimes it does not.

I have checked that we have no problems with the console session (I am logged in by
VNC).

I have checked that the driver is indeed 64bit to rule out the open bitness-related
problem with Windows hooks reported by Jim Evans. 

When I create a test script that 

1) gets a page 
2) sequentially creates 20 screenshots

I see that the first 4 or 5 screenshot are complete, the other 15 truncated. Truncation
starts always after 5 or 6 seconds.

The log files (log level TRACE) do not show anything interesting after these 4 or 5
seconds. Nor does the screenshot handler output looks any different for the "good"
cased or the bad ones.

I have equipped the ScreenshotCommandHandler with OutputDebugString() commands to be
able to observe the behavior also in the CallWndProc hook and the WndProc. (I actually
have not the faintest clue about Windows programming, so maybe this is not how these
things are usually debugged). What I see is that in the "bad cases" InstallWindowsHook()
does indeed install the hook correctly (at least ::SetWindowsHookEx() does not return
NULL) However, the windows hook is never executed. In the first test case described
above with Sleep(20) the Hook is not even called once, hence I would rule out some
Win7 nazi mechanism reaping bad-behaved hooks. 

I got the impression that the situation "improves" (in the sense that the probability
of truncated screenshots is reduced) when the screenshot handler runs "slower". For
instance, setting the log level to TRACE improves the situation a lot as well when
I put a Sleep exactly *before* the InstallWindowsHooks() call. 

All in all, this is very difficult to debug for a Windows noob like me and that the
problem sometimes disappears for no visible reason only to reappear 30 minutes later
makes debugging not easier.

Are there any more things I can try? Any ideas where this magical wall of 5 seconds
may come from (I have found a suspicious registry setting called LowLevelHooksTimeout
but changing the value did not help and CallWndProc is not a low level hook, anyway).


As a hint, the situation seems to be far better with faster computers. On my local
machine with a Win8 IE11 virtual machine, out of 50 screenshots "only" 3 are truncated
(but not sure if this is related).

Reported by [email protected] on 2015-02-13 13:40:23

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by barancev on 2015-02-13 20:39:47

  • Labels added: Browser-IE

lukeis avatar Mar 04 '16 09:03 lukeis

Hi again, 

I am not sure if there is anybody else affected by this issue or if
someone will really be able to reproduce this problem (or if there is an easy/quick
fix).

Therefore I am trying to find a solution that would at least work for us (and ideally
also for others). One idea would be to decorate the IE window procedure as soon as
the page is loaded (and not only for intercepting WM_GETMINMAXINFO messages (I am sceptical
that this place of free of race conditions, anyway)). Are there any obvious pitfalls
in doing this?

Reported by [email protected] on 2015-02-19 10:55:47

lukeis avatar Mar 04 '16 09:03 lukeis

Don't use 64-bit version, see [1] for more details.

[1] http://jimevansmusic.blogspot.ru/2014/09/screenshots-sendkeys-and-sixty-four.html

Reported by barancev on 2015-03-08 20:23:35

  • Status changed: WontFix

lukeis avatar Mar 04 '16 09:03 lukeis

Hi Alexei, 

thank you for your response. I am not sure if I understand your suggestion correctly
as

1) Jim Evans writes in its blog post (the one you are referring to)

> Conversely, for the 64-bit IEDriverServer, the hook can be successfully 
> installed in the top-level window for use in taking screenshots, 
> because the process owning that window is a 64-bit process.

I understood that he suggests to use the 64bit driver to be able to get screenshots

and the 32bit driver to be able to have sendKeys() without the dreaded 5 second delay.

Is this wrong?

2) Our problem does only show up randomly, and from what I understand
the bitness problem would consistently lead to to truncated screenshots.  

Thanks, 
Michael

Reported by michaelmi31415 on 2015-03-08 21:47:58

lukeis avatar Mar 04 '16 09:03 lukeis

Oops! I didn't mean to close the issue, sorry.
Just an advice to avoid 64-it IE driver :)

Reported by barancev on 2015-03-08 21:53:31

  • Status changed: New

lukeis avatar Mar 04 '16 09:03 lukeis

No problem :) Is there really an alternative to the 64bit driver? I mean we "only" want
be able to use IE10 / IE11 on Win7 and get full-page screenshots. How do others do
that? As said, from what I have read I would assume that with the 32bit driver I would
always get truncated screenshots.

Reported by michaelmi31415 on 2015-03-08 22:11:44

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:31

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 09:03 lukeis