Skip to content

Add option to enable connecting to multiple authenticated proxies during tests #1832

New issue

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

Closed
mdmintz opened this issue Apr 10, 2023 · 1 comment · Fixed by #1836
Closed

Add option to enable connecting to multiple authenticated proxies during tests #1832

mdmintz opened this issue Apr 10, 2023 · 1 comment · Fixed by #1836
Assignees
Labels
enhancement Making things better SeleniumBase 4 SeleniumBase 4

Comments

@mdmintz
Copy link
Member

mdmintz commented Apr 10, 2023

Add option to enable connecting to multiple authenticated proxies during tests

Currently, proxy.zip and proxy_ext_dir are hardcoded so that tests can connect to a proxy and reuse the same config, but that can be limiting if people want to connect to multiple proxies for multi-threaded tests. I'm planning on adding the following options to allow for flexible naming based on number increments:

  • --multi-proxy (Command-line option for pytest)
  • multi_proxy=True (SB manager, Driver manager, browser_launcher direct calls)

This would result in creating proxy_1.zip, proxy_2.zip, etc. and proxy_ext_dir_1, proxy_ext_dir_2, etc. for each test so that different authenticated proxies can be used.

Eg. (Via parameterized tests):

from parameterized import parameterized
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)

class SearchTests(BaseCase):
    @parameterized.expand(
        [
            ["user1:pass1@server1:port1"],
            ["user2:pass2@server2:port2"],
            ["user3:pass3@server3:port3"],
        ]
    )
    def test_parameterized_proxy(self, proxy_string):
        self.get_new_driver(proxy=proxy_string)
        # ...

And run that with: pytest -n=3 --multi-proxy

Enabling this via an option (rather than having this always enabled) is important so that the downloaded_files folder (where proxy config files are stored) isn't getting polluted with multiple identical files when the same proxy configuration is being used for all tests on purpose.

@mdmintz mdmintz added enhancement Making things better SeleniumBase 4 SeleniumBase 4 labels Apr 10, 2023
@mdmintz mdmintz self-assigned this Apr 10, 2023
@mdmintz
Copy link
Member Author

mdmintz commented Apr 11, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Making things better SeleniumBase 4 SeleniumBase 4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant