-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathraw_multi_cdp.py
More file actions
23 lines (19 loc) · 731 Bytes
/
raw_multi_cdp.py
File metadata and controls
23 lines (19 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Testing multiple CDP drivers using the sync API
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(url, lang="en")
sb.set_window_rect(randint(4, 680), randint(8, 380), 840, 520)
sb.press_keys("input", "Text")
sb.highlight("button")
sb.click("button")
sb.sleep(2)
sb.driver.quit()
if __name__ == "__main__":
urls = ["https://seleniumbase.io/demo_page" for i in range(5)]
with decorators.print_runtime("raw_multi_cdp.py"):
with ThreadPoolExecutor(max_workers=len(urls)) as executor:
for url in urls:
executor.submit(main, url)