Skip to content

Converting SeleniumWire's undetected_chromedriver to use multi-threading in SeleniumBase. #2097

Answered by mdmintz
ismail-amouma asked this question in Q&A
Discussion options

You must be logged in to vote

If you're looking to run multi-threaded tests in UC Mode with a proxy, here's the scoop:

Multi-threading in UC Mode is possible if you use pytest multi-threading provided by pytest-xdist.

You'll need to use command-line options for this format, eg --uc to activate UC Mode, -n4 (for 4 parallel processes, etc), and --proxy=user:pass@host:port to set proxy settings.

Below is a sample run command:

pytest --uc -n4

(Add --proxy=user:pass@host:port to include proxy settings.)

Here's a sample file that uses @pytest.mark.parametrize() to turn one test into four tests when run with pytest:

import pytest

@pytest.mark.parametrize("", [[]] * 4)
def test_multi_threaded(sb):
    sb.driver.get("https:…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ismail-amouma
Comment options

@mdmintz
Comment options

@ismail-amouma
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants