Now I want to use selenium for some automation of my website. I have pip-installed selenium and downloaded and unzipped the Firefox binary file. The problem now is that whenever I try to initialize the webdriver, for some reason it cannot use the Firefox driver's binary. Below is my code. Unfortunately, I do not have write access, so I cannot move the driver's binary to /usr/local/bin or any other similar directory. So I need to store the driver's binary in a custom directory.
from selenium import webdriver
from selenium.webdriver import FirefoxOptions
from selenium.webdriver.firefox.service import Service
options = FirefoxOptions()
options.binary_location = r'geckodriver'
s = Service(executable_path = r'geckodriver')
driver = webdriver.Firefox(service = s, options = options)
This raises the error:
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable
So please tell me what did I mess and how to solve this problem. Thanks in advance