This is my current code in python 2.7:
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Create a new instance of the Firefox driver
driver = webdriver.Firefox('geckodriver.exe')
# go to the google home page
driver.get("http://www.google.com find the element that's name attribute is q (the google search box)")
inputElement = driver.find_element_by_name("q")
# type in the search
inputElement.send_keys("Cheese!")
# submit the form (although google automatically searches now without submitting)
inputElement.submit()
# the page is ajaxy so the title is originally this:
print driver.title
try:
# we have to wait for the page to refresh, the last thing that seems to be updated is the title
WebDriverWait(driver, 10).until(EC.title_contains("cheese!"))
# You should see "cheese! - Google Search"
print driver.title
finally:
driver.quit()
Here is my error I'm recieving:
Traceback (most recent call last): File "C:\Users\Brandon\Desktop\test55.py", line 7, in driver = webdriver.Firefox('geckodriver.exe') File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 134, in init firefox_profile = FirefoxProfile(firefox_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 78, in init ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock")) File "C:\Python27\lib\shutil.py", line 171, in copytree names = os.listdir(src) WindowsError: [Error 3] The system cannot find the path specified: 'geckodriver.exe/.'
I want the browser driver to be defined from the same folder as the program not from the PATH.
Any help please?