How to properly setup Windows7 to use Selenium with Firefox [TDD with Python]?

前端 未结 2 878
野的像风
野的像风 2021-01-16 02:49

I\'m getting my system (Windows 7 Pro 64 bit, Python 3.5 through Anaconda) setup to use Firefox through selenium to follow the book Test Driven Development with Python.<

2条回答
  •  我在风中等你
    2021-01-16 03:11

    Make sure you have downloaded GeckoDriver for win-64 bit as you have 64-bit machine. Now copy paste downloaded GeckoDriver executable inside 'Script' folder(this folder is present inside the root folder where python is installed in your system). Now set the path of python root folder and 'Script' folder in Environment variable

    C:\..Python; //path of python root folder 
    C:\..Python\Scripts; //path of python 'Script' folder
    

    Don't forget to restart your system for the changes to take effect & try this sample code

    from selenium import webdriver
    driver = webdriver.Firefox()
    driver.get("http://google.com")
    

提交回复
热议问题