|
7 | 7 | import warnings
|
8 | 8 | import percy
|
9 | 9 | import requests
|
10 |
| -import tempfile |
11 | 10 |
|
12 | 11 | from selenium import webdriver
|
13 | 12 | from selenium.webdriver.support import expected_conditions as EC
|
@@ -486,36 +485,10 @@ def _get_chrome(self):
|
486 | 485 | if "DASH_TEST_CHROMEPATH" in os.environ:
|
487 | 486 | options.binary_location = os.environ["DASH_TEST_CHROMEPATH"]
|
488 | 487 |
|
489 |
| - options.add_experimental_option( |
490 |
| - "prefs", |
491 |
| - { |
492 |
| - "download.default_directory": self.download_path, |
493 |
| - "download.prompt_for_download": False, |
494 |
| - "download.directory_upgrade": True, |
495 |
| - "safebrowsing.enabled": False, |
496 |
| - "safebrowsing.disable_download_protection": True, |
497 |
| - }, |
498 |
| - ) |
499 | 488 | options.add_argument("--disable-dev-shm-usage")
|
500 | 489 | options.add_argument("--no-sandbox")
|
501 | 490 | options.add_argument("--disable-gpu")
|
502 |
| - options.add_argument("--remote-debugging-port=9222") |
503 |
| - |
504 |
| - if not self._remote: |
505 |
| - try: |
506 |
| - # Create a TemporaryDirectory object. |
507 |
| - # It will be cleaned up when self._temp_user_data_dir_manager.cleanup() is called, |
508 |
| - # or when the object is garbage collected if not cleaned up explicitly. |
509 |
| - self._temp_user_data_dir_manager = tempfile.TemporaryDirectory() |
510 |
| - user_data_dir_path = self._temp_user_data_dir_manager.name |
511 |
| - options.add_argument(f"--user-data-dir={user_data_dir_path}") |
512 |
| - logger.info( |
513 |
| - f"Chrome using temporary user data directory: {user_data_dir_path}" |
514 |
| - ) |
515 |
| - except Exception as e: |
516 |
| - logger.error( |
517 |
| - f"Could not create temporary directory for user-data-dir: {e}" |
518 |
| - ) |
| 491 | + options.add_argument("--remote-debugging-port=0") |
519 | 492 |
|
520 | 493 | chrome = (
|
521 | 494 | webdriver.Remote(command_executor=self._remote_url, options=options) # type: ignore[reportAttributeAccessIssue]
|
|
0 commit comments