I've downloaded the latest version of Firefox and corresponding (64 bit) geckodriver. Added the location of the geckodriver executable to PATH. Yet, when I execute the following code:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.google.com')
to call Firefox, I get the following error:
Traceback (most recent call last):
File "C:\Users\Karun\Documents\NJCC all data at once Selenium.py", line 2, in <module>
browser = webdriver.Firefox()
File "C:\Users\Karun\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 162, in __init__
keep_alive=True)
File "C:\Users\Karun\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Users\Karun\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Karun\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\Users\Karun\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: permission denied
The error you are seeing does gives us a hint about what could have gone wrong as follows :
Traceback (most recent call last):
File "C:\Users\Karun\Documents\NJCC all data at once Selenium.py", line 2, in <module>
browser = webdriver.Firefox()
selenium.common.exceptions.SessionNotCreatedException: Message: permission denied
Though you mentioned that you have added the location of the geckodriver executable to PATH but still facing the above mentioned error, so a simple solution will be to download the latest GeckoDriver from mozilla/geckodriver and pass the Key executable_path
along with the Value of the absolute path of the GeckoDriver binary while initializing the webdriver and Web Browser instance as follows :
from selenium import webdriver
driver=webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
driver.get("http://www.google.com")
print("Page Title is : %s" %driver.title)
driver.quit()
Additionally ensure that you are using :