Replies: 1 comment 1 reply
|
You can do stealthy multithreading with CDP Mode without a Selenium Grid via from concurrent.futures import ThreadPoolExecutor
from random import randint
from seleniumbase import decorators
from seleniumbase import sb_cdp
def main(url):
sb = sb_cdp.Chrome()
sb.goto(url)
sb.set_window_rect(randint(4, 680), randint(8, 380), 840, 520)
sb.sleep(1.2)
sb.solve_captcha()
sb.sleep(2.2)
sb.quit()
if __name__ == "__main__":
urls = ["https://www.bing.com/turing/captcha/challenge" for i in range(4)]
with decorators.print_runtime("raw_multi_captcha.py"):
with ThreadPoolExecutor(max_workers=len(urls)) as executor:
for url in urls:
executor.submit(main, url)This is the recommended way to handle stealthy multithreading. There's no need for the Selenium Grid, which will take away stealth because it uses WebDriver. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I know UC Mode / CDP Mode is currently not compatible with Selenium Grid / Remote WebDriver.
I saw Selenium Grid 4.41 added
NodeSessionFactoryProvider- a SPI to plug custom session factories via--extwithout patchingselenium-server.jar. Kubernetes Dynamic Grid is built on it.Would that make it possible to support stealth CDP on the Grid? I.e. a custom factory / node image that launches Chrome the stealth way on the node, and lets SeleniumBase drive it via CDP?
My use case is simply: I want
SB(uc=True)+activate_cdp_mode()/sb_cdpbehavior, but distributed on a Grid (Docker / K8s) instead of local-only.Thanks!
Refs:
All reactions