Skip to content
This repository was archived by the owner on Dec 24, 2023. It is now read-only.
This repository was archived by the owner on Dec 24, 2023. It is now read-only.

'saveScreen' method does not work on pages with '*/xml' content type  #30

@idem7x

Description

@idem7x

Environment (please complete the following information):

  • Node.js version: [10.16.0]
  • NPM version: [6.9.0]
  • Browser name and version: [Firefox, IE, Edge]
  • Platform name and version: [Windows 10, Mac OS X]
  • Framework name and version: [@wdio/jasmine-framework 5.11.0 ]
  • Plugin name and version: [wdio-image-comparison-service 1.3.0]
  • webdriver-image-comparison version: [0.6.0]

Config of the automation framework + plugin

services: [
    ['image-comparison',
      {
        baselineFolder: join(process.cwd(), './tools/jasmine/image/expected/'),
        formatImageName: '{tag}-{width}x{height}',
        screenshotPath: join(process.cwd(), './tools/jasmine/image/actual'),
        savePerInstance: true,
        autoSaveBaseline: true,
        blockOutStatusBar: true,
        blockOutToolBar: true,
        returnAllCompareData: true,
        clearRuntimeFolder: true
      }
    ]
  ]

Describe the bug
In case of visit any page with content type 'text/xml', 'application/xml', 'application/xhtml', 'saveScreen' method can't make screenshot on page due to different reasons:

  • Firefox 68 - javascript error: TypeError: document.body is null
  • IE 11- Error: JavaScript error
  • Edge 17 - Error: Unable to get property 'style' of undefined or null reference

However, it correctly works on Chrome 75 and Safari 12.

To Reproduce

describe('XML tests', () => {
    it('XML is correctly displayed for content type text xml', () => {
      browser.url('put here any site with text/xml content type');
      browser.pause(3000);
      browser.saveScreen('test');
  });
});

Expected behavior
Screenshot should be taken.

Log
Example for Firefox:

2019-07-29T16:29:32.757Z INFO webdriver: COMMAND navigateTo("testPage.xml")
2019-07-29T16:29:32.758Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/aeae0af7-b890-df49-83b1-5c8b07a1e3ca/url
2019-07-29T16:29:32.758Z INFO webdriver: DATA { url:
   'testPage.xml' }
2019-07-29T16:29:35.942Z INFO webdriver: COMMAND saveScreen("test")
2019-07-29T16:29:35.944Z INFO webdriver: COMMAND executeScript("return (function hideScrollBars(hide) {
    if (hide) {
        document.body.style.overflow = 'hidden';
    }
    else {
        document.body.style.overflow = '';
    }
}).apply(null, arguments)", <object>)
2019-07-29T16:29:35.945Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/aeae0af7-b890-df49-83b1-5c8b07a1e3ca/execute/sync
2019-07-29T16:29:35.945Z INFO webdriver: DATA { script:
   'return (function hideScrollBars(hide) {\n    if (hide) {\n        document.body.style.overflow = \'hidden\';\n    }\n    else {\n        document.body.style.overflow = \'\';\n    }\n}).apply(null, arguments)',
  args: [ true ] }
2019-07-29T16:29:35.951Z DEBUG webdriver: request failed due to response error: javascript error
2019-07-29T16:29:35.951Z WARN webdriver: Request failed due to TypeError: document.body is null

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions