Skip to content Skip to sidebar Skip to footer

How To Write Selenium Webdriver Path Address With Python In Windows 10?

I'm making a simple web crawler using Python with selenium. (Running on PyCharm Window 10) from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.comm

Solution 1:

Here is the Answer to your Question:

There is no Best Practice to copy/access the driver executable in the Automation Script but on my Windows 8 Pro machine with PyCharm IDE through Python 3.6.1, I explicitly mention the absolute path of the driver executable so that I can work with different versions of different driver executable as well as different Mozilla Firefox versions as follows:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
caps = DesiredCapabilities().FIREFOX
caps["marionette"] = True
driver = webdriver.Firefox(capabilities=caps, firefox_binary=binary, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
driver.get('https://stackoverflow.com')

Let me know if this Answers your Question.

Solution 2:

address should be within quotes as below.

from bs4 importBeautifulSoupfrom selenium import webdriver
from selenium.webdriver.common.keysimportKeys

driver = webdriver.Firefox()
driver.get("http://www.python.org")

Post a Comment for "How To Write Selenium Webdriver Path Address With Python In Windows 10?"