We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
cdp_util.start_sync()
I was working on a new multithreading example for the SB CDP API when I encountered the error from:
import asyncio from concurrent.futures import ThreadPoolExecutor from random import randint from seleniumbase.core import sb_cdp from seleniumbase.undetected import cdp_driver def main(url): loop = asyncio.new_event_loop() driver = cdp_driver.cdp_util.start_sync() page = loop.run_until_complete(driver.get(url)) sb = sb_cdp.CDPMethods(loop, page, driver) sb.set_window_rect(randint(4, 720), randint(8, 410), 800, 500) sb.press_keys("input", "Text") sb.highlight("button") sb.click("button") sb.sleep(2) if __name__ == "__main__": urls = ["https://seleniumbase.io/demo_page" for i in range(4)] with ThreadPoolExecutor(max_workers=len(urls)) as executor: for url in urls: executor.submit(main, url)
That caused the script to end early. (Multithreading masked the error from the console output.)
The logic in cdp_util.start_sync() should be updated:
loop
asyncio.new_event_loop()
asyncio.get_event_loop()
RuntimeError
The text was updated successfully, but these errors were encountered:
This was resolved in 4.34.8 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.34.8
4.34.8
Sorry, something went wrong.
mdmintz
Successfully merging a pull request may close this issue.
There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
incdp_util.start_sync()
(when multithreaded)I was working on a new multithreading example for the SB CDP API when I encountered the error from:
That caused the script to end early. (Multithreading masked the error from the console output.)
The logic in
cdp_util.start_sync()
should be updated:loop
kwarg to use an existing event loop.asyncio.new_event_loop()
instead ofasyncio.get_event_loop()
ifRuntimeError
.The text was updated successfully, but these errors were encountered: