You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👤 You can also set the `reconnect_time` / `timeout` to `"breakpoint"` as a valid option. This allows the user to perform manual actions (until typing `c` and pressing ENTER to continue from the breakpoint):
(If you remain undetected while loading the page and performing manual actions, then you know you can create a working script once you swap the breakpoint with a time, and add special methods like `uc_click` as needed.)
155
+
156
+
👤 <b>Multithreaded UC Mode:</b>
157
+
158
+
If you're using `pytest` for multithreaded UC Mode (which requires using one of the `pytest`[syntax formats](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md)), then all you have to do is set the number of threads when your script runs. (`-n NUM`) Eg:
159
+
160
+
```bash
161
+
pytest --uc -n 4
162
+
```
163
+
164
+
(Then `pytest-xdist` is automatically used to spin up and process the threads.)
165
+
166
+
If you don't want to use `pytest` for multithreading, then you'll need to do a little more work. That involves using a different multithreading library, (eg. `concurrent.futures`), and making sure that thread-locking is done correctly for processes that share resources. To handle that thread-locking, include `sys.argv.append("-n")` in your SeleniumBase file.
167
+
168
+
Here's a sample script that uses `concurrent.futures` for spinning up multiple processes:
169
+
170
+
```python
171
+
import sys
172
+
from concurrent.futures import ThreadPoolExecutor
173
+
from seleniumbase import Driver
174
+
sys.argv.append("-n") # Tell SeleniumBase to do thread-locking as needed
175
+
176
+
deflaunch_driver(url):
177
+
driver = Driver(uc=True)
178
+
try:
179
+
driver.get(url=url)
180
+
driver.sleep(2)
181
+
finally:
182
+
driver.quit()
183
+
184
+
urls = ['https://seleniumbase.io/demo_page'for i inrange(3)]
185
+
with ThreadPoolExecutor(max_workers=len(urls)) as executor:
0 commit comments