Fix failing unit test

Includes also a small improvement (possible fix) for image capturing. Do not allow grabbing of non active page.