0

--------Reply to Post being Labeled as a Duplicate question

Since I am still learning the programming basics I was not sure whether the material on the alternate post was relevant especially since I was on the first example of code in the the section. So I believe it's beneficial to have the exact code requested by the textbook with note of the error and key words which will improve search engine rank for people troubleshooting common errors in Automate the Boring Stuff with Python. This unique phrasing of the question herein the post will help fellow beginners using this book understand the error is a result of outdated programming instructions.*

Also, special kudos to my friend here, Stef Verdonka, who has responded with simple and easy to understand fix.

Automate the Boring Stuff with Python outdated instructions for launching Selenium browser

Solution

*********See Stef Verdonk's answer.

Original post

I am a noob python programmer and have recently been pushing through my first textbook on this language called "Automate the Boring Stuff with Python". I have gotten to the web scraping section and I am being instructed to access firefox via Selenium. I have found a few resources online about my error message but I do not have enough experience to relate back to a solution for myself. Here is the code and then error code it leaves.

from selenium import webdriver
browser = webdriver.Firefox()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 81, in __init__
self.binary, timeout)
File "C:\Python35-32\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Python35-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "C:\Python35-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 98, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
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.

So I believe that my firefox does not support Selenium as it has in past versions. link to back this up: FirefoxDriver will stop working at version 47 of Firefox

So that's all I've got right now I would appreciate some help on this and I think it would help a lot of a lot of other people out if we could format a simple solution to this problem that seems to be pretty common. Sorry if this has been asked. I've looked through a lot of the questions on here and just couldn't get any success.

I'm using python 3.5 on windows 10

Community
  • 1
  • 1
Nick Abel
  • 15
  • 3

1 Answers1

1

You were already half way with the link you provided. Since the latest firefox 47 upgrade. The selenium web-driver has become deprecated and you will need Marionette to run firefox:

Instructions here

Another solution which would allow you to keep using existing scripts is to downgrade firefox. For wich I would suggest downgrading to version 45 (ESR version). This will ensure that you can still get security updates:

Download firefox 45 ESR

Stef Verdonk
  • 596
  • 1
  • 5
  • 6