question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: ChromeDriver producing NoSuchWindowException for v106+ on macOS

See original GitHub issue

What happened?

After an auto update to chrome v106 and it’s corresponding driver, whenever we (at least 3 of us have reproduced the issue) try to run our selenium python tests on our mac development machines we get a NoSuchWindowException for tests longer than a few seconds. (Don’t know the exact cutoff time, but provided an example below) This was the same both before and after upgrading to macOS Ventura 13.0.

We can reproduce this for any v106 and v107 chrome versions, downgrading to chrome v105 (currently using chrome v105.0.5195.127 with driver v105.0.5195.19.0) does not have the issue and we are able to run using that. Latest version attempted is chrome v107.0.5304.87 with driver v107.0.5304.62

Running the same tests on a windows machine produced no issue.

How can we reproduce the issue?

from time import sleep

from selenium.webdriver import DesiredCapabilities, Keys
from selenium.webdriver.chrome.options import Options
import selenium
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager

caps = {"browserName": "chrome", 'goog:loggingPrefs': {'performance': 'ALL'}}

options = Options()
options.add_argument("window-size=1920,1080")
options.headless = False
driver = selenium.webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options, desired_capabilities=caps)

driver.get("https://www.google.com")
el = WebDriverWait(driver, 10).until(lambda d: d.find_element(by=By.CSS_SELECTOR, value="input[title='Search']"))
el.send_keys("Test")
el.send_keys(Keys.RETURN)
# Commenting out the sleep line causes the test to work every time.
# Leaving it in causes the test to fail every time.
sleep(10)
WebDriverWait(driver, 10).until(lambda d: d.find_element(by=By.XPATH, value="//a[text()='News']"))
driver.close()

Relevant log output

Traceback (most recent call last):
  File "/Users/calumtimpany/PycharmProjects/test-automation/data/desktop/error_test.py", line 23, in <module>
    WebDriverWait(driver, 10).until(lambda d: d.find_element(by=By.XPATH, value="//a[text()='News']"))
  File "/Users/calumtimpany/PycharmProjects/test-automation/venv/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 81, in until
    value = method(self._driver)
  File "/Users/calumtimpany/PycharmProjects/test-automation/data/desktop/error_test.py", line 23, in <lambda>
    WebDriverWait(driver, 10).until(lambda d: d.find_element(by=By.XPATH, value="//a[text()='News']"))
  File "/Users/calumtimpany/PycharmProjects/test-automation/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 856, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/Users/calumtimpany/PycharmProjects/test-automation/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/Users/calumtimpany/PycharmProjects/test-automation/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: chrome=107.0.5304.87)
Stacktrace:
0   chromedriver                        0x00000001039a62c8 chromedriver + 4752072
1   chromedriver                        0x0000000103926463 chromedriver + 4228195
2   chromedriver                        0x0000000103589b18 chromedriver + 441112
3   chromedriver                        0x0000000103566210 chromedriver + 295440
4   chromedriver                        0x00000001035ebe3d chromedriver + 843325
5   chromedriver                        0x00000001035ff719 chromedriver + 923417
6   chromedriver                        0x00000001035e7b33 chromedriver + 826163
7   chromedriver                        0x00000001035b89fd chromedriver + 633341
8   chromedriver                        0x00000001035ba051 chromedriver + 639057
9   chromedriver                        0x000000010397330e chromedriver + 4543246
10  chromedriver                        0x0000000103977a88 chromedriver + 4561544
11  chromedriver                        0x000000010397f6df chromedriver + 4593375
12  chromedriver                        0x00000001039788fa chromedriver + 4565242
13  chromedriver                        0x000000010394e2cf chromedriver + 4391631
14  chromedriver                        0x00000001039975b8 chromedriver + 4691384
15  chromedriver                        0x0000000103997739 chromedriver + 4691769
16  chromedriver                        0x00000001039ad81e chromedriver + 4782110
17  libsystem_pthread.dylib             0x00007ff817239259 _pthread_start + 125
18  libsystem_pthread.dylib             0x00007ff817234c7b thread_start + 15


Process finished with exit code 1

Operating System

macOS Ventura (13.0)

Selenium version

Python 4.5.0

What are the browser(s) and version(s) where you see this issue?

Chrome 106 through Chrome 107.0.5304.87

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 107.0.5304.62

Are you using Selenium Grid?

No

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
titusfortnercommented, Nov 8, 2022

Yeah, whatever the issue here, it’s a bug in chromedriver. Looks like Google is working on that issue, hopefully the same fix works for this issue as well.

0reactions
github-actions[bot]commented, Dec 9, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be ...
I am facing the below error when I run the selenium code to launch the chrome browser. "“chromedriver” cannot be opened because the...
Read more >
Fixing error: “chromedriver” cannot be opened because the ...
Solution: 1) Find a path to chromedriver binary; 2) Tell MacOS to trust the binary by lifting the quarantine via the following command......
Read more >
WebDriver for Chrome - Downloads
Resolved issue 4207: WebDriver error when running WPT [Pri-1]. For more details, please see ... Supports Chrome version 106. For more details, please...
Read more >
[FIXED] "NoSuchWindowException: no such ... - PythonFixing
Chrome (executable_path = r'S:\Engineering\Jake\MasterControl Completing ... to waiting for 2 window handles still kept throwing an error.
Read more >
Resolving failed to create ChromeDriver error - Provar
Step 1: Disable Provar's auto-update feature (ChromeDriver versioning) by making the following entry in the provar.ini file at the installed location. Typically ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found