CDP-Patches
CDP-Patches copied to clipboard
[BUG] undetected_playwright is not supported.
Describe the bug
undetected_playwright
is not supported. Normal playwright
does have import, but not undetected_playwright
. Throws TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
again.
Code Sample
#undetected_playwright import
from undetected_playwright.sync_api import sync_playwright
from cdp_patches.input import SyncInput
import requests
import csv
def get_locator_pos(locator):
bounding_box = locator.bounding_box()
assert bounding_box
x, y, width, height = bounding_box.get("x"), bounding_box.get("y"), bounding_box.get("width"), bounding_box.get("height")
assert x and y and width and height
x, y = x + width // 2, y + height // 2
return x, y
with sync_playwright() as p:
args = []
args.append("--disable-blink-features=AutomationControlled")
browser = p.chromium.launch(headless=False, args=args)
page = browser.new_page()
sync_input = SyncInput(browser=browser)
page.goto("any page")
verify_element = page.locator('any element locator')
x, y = get_locator_pos(verify_element)
sync_input.click("left", x, y)
browser.close()
To Reproduce
Steps to reproduce the behavior:
- Just install
undetected_playwright
. Use it to open any website. - Use
cdp-patches
. - Run the code.
- See error.
Expected behavior
There is no import for undetected_playwright
for sync as well as async https://github.com/Kaliiiiiiiiii-Vinyzu/CDP-Patches/blob/602b680abf50b8190a5955ec7feb8c2045002e8d/cdp_patches/input/browsers.py#L14
Screenshots
None
Desktop (please complete the following information):
- OS: Windows 10
Additional context None