zazga
zazga

Reputation: 366

Why does my Selenium not stop loading?

I have used Selenium in the past and was pretty happy with it.

When I started a new project I wanted to use it again. Since it has been a long time and my ChromeDriver 2.20 didn't seem to work I updated to 2.25. This seemed to work but that's only an illusion.

It seems the driver.get("whateveryouputhere") never fully loads the page.

from selenium import webdriver

driver = webdriver.Chrome('/Users/Sascha-mac/Desktop/chromedriver')
driver.get("http://www.python.org")
driver.close()

This does open a Chrome tab that navigates to www.python.org as you'd expect it to. However, it doesn't close the driver.

Even a simple print "HELLO" doesn't come through until I manually close Chrome.

I have updated to the newest version of Selenium, ChromeDriver. I work on MacOS Sierra with Python 2.7. I have also tested with different websites - no difference.

Where did I go wrong?

Upvotes: 1

Views: 83

Answers (1)

uchuugaka
uchuugaka

Reputation: 12782

driver.close() closes the window. driver.quit() terminates the browser.

macOS apps that have multiple documents generally do not terminate when the last window is closed. The macOS convention is that only single window apps should do that and traditionally few of those do that. You might be confused by the common Windows behavior.

Upvotes: 1

Related Questions