# Path: applitools/selenium/positioning.py
# class StitchMode(object):
#     """
#     The type of methods for stitching full-page screenshots.
#     """
#     Scroll = "Scroll"
#     CSS = "CSS"
# 
# Path: applitools/selenium/target.py
# class Target(object):
#     """
#     Target for an eyes.check_window/region.
#     """
# 
#     def __init__(self):
#         # type: () -> None
#         self._send_dom = False
#         self._use_dom = False
#         self._enable_patterns = False
#         self._ignore_caret = True
#         self._ignore_regions = []  # type: tp.List
#         self._floating_regions = []  # type: tp.List
# 
#     def ignore(self, *regions):
#         # type: (*tp.Union[Region, IgnoreRegionByElement, IgnoreRegionBySelector]) -> Target
#         """
#         Add ignore regions to this target.
#         :param regions: Ignore regions to add. Can be of several types:
#             (Region) Region specified by coordinates
#             (IgnoreRegionBySelector) Region specified by a selector of an element
#             (IgnoreRegionByElement) Region specified by a WebElement instance.
#         :return: (Target) self.
#         """
#         for region in regions:
#             if region is None:
#                 continue
#             if isinstance(region, Region):
#                 self._ignore_regions.append(_NopRegionWrapper(region))
#             else:
#                 self._ignore_regions.append(region)
#         return self
# 
#     def floating(self, *regions):
#         # type: (*tp.Union[FloatingRegion, FloatingRegionByElement, FloatingRegionBySelector]) -> Target
#         """
#         Add floating regions to this target.
#         :param regions: Floating regions to add. Can be of several types:
#             (Region) Region specified by coordinates
#             (FloatingRegionByElement) Region specified by a WebElement instance.
#             (FloatingRegionBySelector) Region specified by a selector of an element
#         :return: (Target) self.
#         """
#         for region in regions:
#             if region is None:
#                 continue
#             self._floating_regions.append(region)
#         return self
# 
#     def ignore_caret(self, ignore=True):
#         # type: (bool) -> Target
#         """
#         Whether we should ignore caret when matching screenshots.
#         """
#         self._ignore_caret = ignore
#         return self
# 
#     def get_ignore_caret(self):
#         return self._ignore_caret
# 
#     def send_dom(self, use=True):
#         self._send_dom = use
#         return self
# 
#     def use_dom(self, use=True):
#         self._use_dom = use
#         return self
# 
#     def enable_patterns(self, enable=True):
#         self._enable_patterns = enable
#         return self


import pytest
from selenium.webdriver.common.by import By
from applitools.selenium import Target, StitchMode
    iframe_id = "TPAMultiSection_j5ocg4p8iframe"
    driver.switch_to().frame(iframe_id)
    # click register button
    driver.find_element(By.CSS_SELECTOR, "[data-hook=get-tickets-button]").click()
    # add one ticket
    driver.find_element(By.CSS_SELECTOR, "[data-hook=plus-button]").click()
    # just an example, where it make us some problems with scrolling to top of the frame.
    # eyes.check_region(By.CSS_SELECTOR, "[data-hook=plus-button]");
    eyes.check("", Target.region(By.CSS_SELECTOR, "[data-hook=plus-button]"))
    eyes.close()


@pytest.mark.platform('Linux', 'Windows', 'macOS')
@pytest.mark.eyes(match_timeout=0, force_full_page_screenshot=False)
def test_w3schools_iframe(eyes, driver):
    driver = eyes.open(driver, app_name="Python SDK", test_name="W3 Schools frame",
                       viewport_size={'width': 800, 'height': 600})
    driver.get('https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe')
    eyes.check_region_in_frame_by_selector("iframeResult", By.TAG_NAME, "body", "Entire Frame", stitch_content=False)
    eyes.close()


@pytest.mark.platform("Linux")
def test_omnicomprgroup(eyes, driver):
    eyes.stitch_mode = StitchMode.CSS
    eyes.force_full_page_screenshot = True
    driver = eyes.open(
        driver, "Python SDK", "TestOmnicomprgroup_FPS", {"width": 400, "height": 600}
    )
    driver.get("https://www.omnicomprgroup.com/")

# Path: applitools/selenium/positioning.py
# class StitchMode(object):
#     """
#     The type of methods for stitching full-page screenshots.
#     """
#     Scroll = "Scroll"
#     CSS = "CSS"
# 
# Path: applitools/selenium/target.py
# class Target(object):
#     """
#     Target for an eyes.check_window/region.
#     """
# 
#     def __init__(self):
#         # type: () -> None
#         self._send_dom = False
#         self._use_dom = False
#         self._enable_patterns = False
#         self._ignore_caret = True
#         self._ignore_regions = []  # type: tp.List
#         self._floating_regions = []  # type: tp.List
# 
#     def ignore(self, *regions):
#         # type: (*tp.Union[Region, IgnoreRegionByElement, IgnoreRegionBySelector]) -> Target
#         """
#         Add ignore regions to this target.
#         :param regions: Ignore regions to add. Can be of several types:
#             (Region) Region specified by coordinates
#             (IgnoreRegionBySelector) Region specified by a selector of an element
#             (IgnoreRegionByElement) Region specified by a WebElement instance.
#         :return: (Target) self.
#         """
#         for region in regions:
#             if region is None:
#                 continue
#             if isinstance(region, Region):
#                 self._ignore_regions.append(_NopRegionWrapper(region))
#             else:
#                 self._ignore_regions.append(region)
#         return self
# 
#     def floating(self, *regions):
#         # type: (*tp.Union[FloatingRegion, FloatingRegionByElement, FloatingRegionBySelector]) -> Target
#         """
#         Add floating regions to this target.
#         :param regions: Floating regions to add. Can be of several types:
#             (Region) Region specified by coordinates
#             (FloatingRegionByElement) Region specified by a WebElement instance.
#             (FloatingRegionBySelector) Region specified by a selector of an element
#         :return: (Target) self.
#         """
#         for region in regions:
#             if region is None:
#                 continue
#             self._floating_regions.append(region)
#         return self
# 
#     def ignore_caret(self, ignore=True):
#         # type: (bool) -> Target
#         """
#         Whether we should ignore caret when matching screenshots.
#         """
#         self._ignore_caret = ignore
#         return self
# 
#     def get_ignore_caret(self):
#         return self._ignore_caret
# 
#     def send_dom(self, use=True):
#         self._send_dom = use
#         return self
# 
#     def use_dom(self, use=True):
#         self._use_dom = use
#         return self
# 
#     def enable_patterns(self, enable=True):
#         self._enable_patterns = enable
#         return self


# Path: tests/selenium/test_client_sites.py
import pytest
from selenium.webdriver.common.by import By
from applitools.selenium import Target, StitchMode

    iframe_id = "TPAMultiSection_j5ocg4p8iframe"
    driver.switch_to().frame(iframe_id)
    # click register button
    driver.find_element(By.CSS_SELECTOR, "[data-hook=get-tickets-button]").click()
    # add one ticket
    driver.find_element(By.CSS_SELECTOR, "[data-hook=plus-button]").click()
    # just an example, where it make us some problems with scrolling to top of the frame.
    # eyes.check_region(By.CSS_SELECTOR, "[data-hook=plus-button]");
    eyes.check("", Target.region(By.CSS_SELECTOR, "[data-hook=plus-button]"))
    eyes.close()


@pytest.mark.platform('Linux', 'Windows', 'macOS')
@pytest.mark.eyes(match_timeout=0, force_full_page_screenshot=False)
def test_w3schools_iframe(eyes, driver):
    driver = eyes.open(driver, app_name="Python SDK", test_name="W3 Schools frame",
                       viewport_size={'width': 800, 'height': 600})
    driver.get('https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe')
    eyes.check_region_in_frame_by_selector("iframeResult", By.TAG_NAME, "body", "Entire Frame", stitch_content=False)
    eyes.close()


@pytest.mark.platform("Linux")
def test_omnicomprgroup(eyes, driver):
    eyes.stitch_mode = StitchMode.CSS
    eyes.force_full_page_screenshot = True
    driver = eyes.open(
        driver, "Python SDK", "TestOmnicomprgroup_FPS", {"width": 400, "height": 600}
    )
    driver.get("https://www.omnicomprgroup.com/")

    eyes.check_window()