1

I am trying an exercise from Automate the Boring Stuff with Python, 2nd edition, and I cannot get the Selenium modules to work to open a specific webpage.

The code from the book is this:

from selenium import webdriver
browser = webdriver.Firefox()
type(browser)
browser.get('https://inventwithpython.com')

Which is also what I am typing into IDLE. However, after I run the program, I get the following list of errors:

Traceback (most recent call last): File "C:/Users/Kyle/Desktop/seleniumTest.py", line 4, in browser = webdriver.Firefox() File "C:\Users\Kyle\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 79, in init executor = ExtensionConnection("127.0.0.1", self.profile, File "C:\Users\Kyle\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in init self.binary.launch_browser(self.profile, timeout=timeout) File "C:\Users\Kyle\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser self._wait_until_connectable(timeout=timeout) File "C:\Users\Kyle\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 98, in _wait_until_connectable raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

which mean nothing to me, and I cannot find a solution.

Firefox ends up opening a blank webpage, but not the URL I put between the paranthesis. I can't figure out what I am doing wrong, and I haven't been able to understand the answers on this same exercise from a post 4+ years ago.

Are there any suggestions as to what I should look at? I hate that I am so bad at coding that I can't figure this out myself.

  • So I was able to (finally) get around this. Sort of. I uninstalled Python 3.8, installed Python 3.7.9, and then reinstalled the Geckodriver. Which led to a host of other issues, but in the end, I moved the Geckodriver to the same folder as Python, and then had to also move the file with the code to the same location. I think I have gotten it now, as I could open one website. Should anyone have a better solution, I am absolutely up for learning it. Thanks! – Kyle Christian Aug 18 '20 at 03:43

0 Answers0