|
3 | 3 | from selenium import webdriver |
4 | 4 | from selenium.common.exceptions import TimeoutException |
5 | 5 | from selenium.webdriver.common.by import By |
| 6 | +from selenium.webdriver.common.utils import free_port |
6 | 7 | from selenium.webdriver.firefox.options import Options |
7 | 8 | from selenium.webdriver.support import expected_conditions as EC |
8 | 9 | from selenium.webdriver.support.ui import WebDriverWait |
@@ -52,9 +53,8 @@ def get_firefox_webdriver(cls): |
52 | 53 | # debugging ports for each TestCase. To accomplish this, |
53 | 54 | # we can leverage the randomized live test server port to |
54 | 55 | # generate a unique port for each browser instance. |
55 | | - marionette_port = cls.server_thread.port + 100 |
56 | 56 | options.set_capability( |
57 | | - 'moz:firefoxOptions', {'args': ['--marionette-port', marionette_port]} |
| 57 | + 'moz:firefoxOptions', {'args': ['--marionette-port', free_port()]} |
58 | 58 | ) |
59 | 59 | kwargs = dict(options=options) |
60 | 60 | # Optional: Store logs in a file |
@@ -96,7 +96,7 @@ def get_chrome_webdriver(cls): |
96 | 96 | # debugging ports for each TestCase. To accomplish this, |
97 | 97 | # we can leverage the randomized live test server port to |
98 | 98 | # generate a unique port for each browser instance. |
99 | | - options.add_argument(f'--remote-debugging-port={cls.server_thread.port + 100}') |
| 99 | + options.add_argument(f'--remote-debugging-port={free_port()}') |
100 | 100 | options.set_capability('goog:loggingPrefs', {'browser': 'ALL'}) |
101 | 101 | return webdriver.Chrome( |
102 | 102 | options=options, |
|
0 commit comments