Selenium, you were such a pain.

In Al Sweigart’s book, there’s a section on working with selenium Module. It drove me nuts for a bit.

He said to enter the following into the interactive shell:Screen Shot 2017-08-03 at 4.56.39 PM.pngI did as told and got the below error as I hit enter after browser = webdriver.Firefox():

Screen Shot 2017-08-03 at 3.19.48 PM.png

It took me quite some time to figure out how to get this working but I got it and I am absolutely thrilled. So here’s what I did –

  • Installed Homebrew by copying and pasting the following into Terminal:Screen Shot 2017-08-03 at 4.37.31 PM.png
  • Typed brew install geckodriver into Terminal once Homebrew was successfully installed and few seconds later, (yay!) got gecko (really hate geckos) on my laptop:Screen Shot 2017-08-03 at 3.49.09 PM.png
  • I then changed the script to the following on the interactive shell:Screen Shot 2017-08-03 at 4.58.30 PM.pngAt this point, there wasn’t any error like before and Firefox launched itself.
  • I continued with the rest of the script:Screen Shot 2017-08-03 at 5.05.13 PM.pngThe webpage then loads on Firefox automatically!Screen Shot 2017-08-03 at 3.57.53 PM.png

This wasn’t an easy one to figure out as most solutions I found online were for Window users and there were million and one different ways to do this and I finally found one that worked for me after a day .

I hope this post is helpful for any Mac users out there facing the same issue with selenium Module.

Happy coding!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s