0

I am testing the following code.

for ex..

from selenium import webdriver;
driver = webdriver.Firefox("C:/Users/bharg/Downloads/geckodriver-v0.29.0-win64")
driver.get("https://www.hotstar.com")
driver.find_element_by_id("searchField").send_keys("Movies")


I am getting the error as Message: 'geckodriver' executable needs to be in PATH.

But I have downloaded the geckodriver and placed the path there.

I am new to this selenium using with python can anyone help me regarding this

Gaj Julije
  • 947
  • 8
  • 28
user
  • 17
  • 7

1 Answers1

0

selenium search for browser drivers in the following order,

  • Executable Path provided
  • Current directory
  • PATH

so you can set geckodriver in the PATH environment variable , note that the PATH should be the path to that directory and not gekodriver itself

Or keep geckodriver in the same directory as your script

or pass it as executable_path argument to the constructor:

https://www.selenium.dev/selenium/docs/api/py/webdriver_firefox/selenium.webdriver.firefox.webdriver.html#module-selenium.webdriver.firefox.webdriver

you can refer the class documentation to see what are the supported named arguments

PDHide
  • 15,234
  • 2
  • 19
  • 35