[š Bug]: Selenium pauses execution of code when using Remote DevTools
See original GitHub issueWhat happened?
Iām launching an instance of ChromeDriver with the remote debugging port option set and I can access the remote dev tools just fine however whenever I do, the script just pauses execution and sits there on the page. There are no errors in the console or in the browser and there are no indicators that anything has gone wrong. One oddity I noticed was that if I repeatedly scroll up and down on the page, the script will continue so long as I continue scrolling.
This issue has already been reported here (#9759) but lacked details so I figured Iād open a new issue. Iām not really sure what to make of all this or even where I should post this issue so Iām just starting here. Iāll be happy to file an issue elsewhere if someone can point me in the right direction.
Steps to reproduce:
- Run the example script below
- Go to http://localhost:9000
- Click on the
React Image Gallery
link - Wait a bit and you should not see the script doing anything
- Rapidly scroll up and down and the script should continue execution
- Stop scrolling and the script should pause
EDIT: You may not have to continuously scroll. I was just able to get the script going again scrolling once in between action. It seems that all it needs is the remote debugger to send it a command/action? Not sure.
How can we reproduce the issue?
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.common.by import By
from selenium import webdriver
from time import sleep
def start_driver():
chrome_options = Options()
chrome_options.add_argument("--remote-debugging-port=9000")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-translate")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-background-networking")
chrome_options.add_argument("--safebrowsing-disable-auto-update")
chrome_options.add_argument("--disable-sync")
chrome_options.add_argument("--metrics-recording-only")
chrome_options.add_argument("--disable-default-apps")
chrome_options.add_argument("--no-first-run")
chrome_options.add_argument("--disable-setuid-sandbox")
chrome_options.add_argument("--hide-scrollbars")
chrome_options.add_argument("--no-zygote")
chrome_options.add_argument("--autoplay-policy=no-user-gesture-required")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--disable-logging")
chrome_options.add_argument("--disable-permissions-api")
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--window-size=1280,720")
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.page_load_strategy = "eager"
capabilities = DesiredCapabilities.CHROME
return webdriver.Chrome(
executable_path="SOME_PATH_TO_CHROME",
options=chrome_options,
desired_capabilities=capabilities
)
driver = start_driver()
for _ in range(50):
driver.get("https://www.linxtion.com/demo/react-image-gallery/")
sleep(5)
right_nav = driver.find_element(By.CLASS_NAME, "image-gallery-right-nav")
for _ in range(5):
right_nav.click()
sleep(2)
Relevant log output
There is none. As far as Selenium is concerned, everything is still operating nominally.
Operating System
Windows 10
Selenium version
Python 4.0.0
What are the browser(s) and version(s) where you see this issue?
Chrome 95
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 95.0.4638
Are you using Selenium Grid?
No
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
Understood. For anyone else who comes across this issue, Iāve opened a ticket with the ChromeDriver team here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3986
Yeah, thereās nothing for Selenium to change. Selenium is sending the correct commands to the driver. If the correct thing isnāt happening in a given configuration, itās because the driver isnāt handling it.