Can't take a screenshot with Appium (browser.checkElement is not a function)

  • Node.js version: 15.0.0
  • NPM version: 7.0.2
  • Browser name and version: Chrome83
  • Platform name and version: Windows 10
  • WebdriverIO version: 7.16.14
  • wdio-image-comparison-service version: 3.1.0
  • Appium 2.0.0-beta.25 ( 1.22.2)

Config of WebdriverIO + wdio-image-comparison-service

    services: [
        // The options
            // Some options, see the docs for more
            baselineFolder: join(process.cwd(), './test/visual test/baseline/'),
            formatImageName: '{tag}-{logName}-{width}x{height}',
            screenshotPath: join(process.cwd(), './test/visual test/chekc/'),
            // savePerInstance: true,
            autoSaveBaseline: true,
            // blockOutStatusBar: true,
            // blockOutToolBar: true,
            // clearRuntimeFolder: true
            // Without this option, it errors out only when mismatch is above 1.23%(by default)
            // ... more options

Describe the bug

  1. after launch, Chrome opens on Pixel 3 (Android Studio emulator).
  2. URL is being navigated
  3. Finds a layout element.
  4. await browser.checkElement(await element, ‘simple’, {}) is called
  5. Error appears in console “browser.checkElement is not a function”
    Playable for any other image comparison or image save function

Repeat for any other image comparison function or image save function

To Reproduce
start Android Emulator Pixel 3
npm i
npm test

link git
I put the logs in the repository link

Expected behavior
Test completed successfully. A screenshot of the element is taken and saved.

I would be very grateful for any help.

I assume this is some issue in the client code, e. g. the checkElement method is undefined there.

You don’t say what language you are using, but I think it’s JavaScript. I’m not as familiar with JS, so correct me if I’m wrong, but I took a look in the JS client code and could not find the checkElement function:

So it would follow that the error you are getting is correct.

I am using TypeScript (JS). If I run the test in a desktop browser with Chromdriver, browser.checkElement works. browser.checkElement is a function of the wdio-image-comparison plugin. His description says that he supports Appium. When I try to use it with Appium it doesn’t work.

Is it this?

More information and documentation will soon come


FWIW, I use ImageMagick for image comparisons:

Yes. It’s him. I wanted to use wdio-image-comparison because it worked well for the desktop browser, it’s flexible and quick to set up. But I like what you suggested. I think I’ll have to do it this way because I still haven’t found a solution.