The below example:
from seleniumbase import SB
with SB(uc=True, locale_code="en", headless=True) as sb:
link = "https://antoinevastel.com/bots/"
print(f"\nOpening {link}")
sb.wait_for_ready_state_complete(timeout=120)
sb.activate_cdp_mode(link)
print(f"Sleeping for some time...")
sb.sleep(5)
[screenwidth,screenheight,innerwidth,innerheight,scrollwidth,scrollheight] = sb.cdp.evaluate("return [window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, document.documentElement.scrollWidth, document.documentElement.scrollHeight];")
print(f"Size: {screenwidth}, {screenheight}, {innerwidth}, {innerheight}, {scrollwidth}, {scrollheight}")
sb.cdp.set_window_rect(0,0,scrollwidth + screenwidth - innerwidth, scrollheight + screenheight - innerheight + 100)
print(f"Sleeping for some time...")
sb.sleep(5)
sb.cdp.save_screenshot(f"screenshot.png")
print(f"Finished!")
Fails the WEBDRIVER
test as it's shown in red color below:
How can I prevent this?
EDIT:
I think I found this issue here
https://github.com/seleniumbase/SeleniumBase/issues/3059
where the author says that he gets the same result as when using a regular Chrome browser, so the Inconsistent value for Webdriver there isn't accurate.
I found a similar issue here
https://github.com/seleniumbase/SeleniumBase/issues/3059
where the author says that he gets the same result as when using a regular Chrome browser, so the Inconsistent value for Webdriver there isn't accurate.
I tested it on a regular Chrome browser and I also got the same Inconsistent value. So author is correct.
SeleniumBase with CDP passes the other sites below:
https://deviceandbrowserinfo.com/info_device
https://demo.fingerprint.com/playground