docstr: Compare a screenshot with screenshot from a past run.
  
  Parameters
  ----------
  element : ElementHandle or Locator
      The element to take a screenshot of.
  image_threshold : float, optional
      The allowed percentage of different pixels in the image.
  pixel_threshold : float, optional
      The allowed percentage of difference for a single pixel.
  name : str | None, optional
      The name of the screenshot without an extension. If not provided, the name
      of the test function will be used.
  fail_fast : bool, optional
      If True, the comparison will stop at the first pixel mismatch.
docstr_tok: ["Compare","a","screenshot","with","screenshot","from","a","past","run",".","Parameters","--","--","--","--","--","element",":","ElementHandle","or","Locator","The","element","to","take","a","screenshot","of",".","image_threshold",":","float",",","optional","The","allowed","percentage","of","different","pixels","in","the","image",".","pixel_threshold",":","float",",","optional","The","allowed","percentage","of","difference","for","a","single","pixel",".","name",":","str","|","None",",","optional","The","name","of","the","screenshot","without","an","extension",".","If","not","provided",",","the","name","of","the","test","function","will","be","used",".","fail_fast",":","bool",",","optional","If","True",",","the","comparison","will","stop","at","the","first","pixel","mismatch","."]
code: def __call__(
      self,
      element: ElementHandle | Locator | Page,
      *,
      image_threshold: float = 0.002,
      pixel_threshold: float = 0.05,
      name: str | None = None,
      fail_fast: bool = False,
  ) -> None:
      """Compare a screenshot with screenshot from a past run.
  
      Parameters
      ----------
      element : ElementHandle or Locator
          The element to take a screenshot of.
      image_threshold : float, optional
          The allowed percentage of different pixels in the image.
      pixel_threshold : float, optional
          The allowed percentage of difference for a single pixel.
      name : str | None, optional
          The name of the screenshot without an extension. If not provided, the name
          of the test function will be used.
      fail_fast : bool, optional
          If True, the comparison will stop at the first pixel mismatch.
      """
  
imports: from __future__ import annotations
  import hashlib
  import os
  import re
  import shlex
  import shutil
  import socket
  import subprocess
  import sys
  import time
  from io import BytesIO
  from pathlib import Path
  from random import randint
  from tempfile import TemporaryFile
  from types import ModuleType
  from typing import Any, Dict, Generator, List, Literal, Protocol, Tuple
  from urllib import parse
  import pytest
  import requests
  from PIL import Image
  from playwright.sync_api import ElementHandle, Locator, Page
  from pytest import FixtureRequest
label_desc: Use image node_id 1 for calling the ImageCompareFunction obj's underlying member method code with example usage: obj.__call__(element) without return types