I am using the following code.
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
#login
driver = webdriver.Chrome()
driver.get("url")
#time.sleep(10)
driver.set_window_size(920, 680)
driver.find_element(By.ID, "loginUserName").send_keys("xx")
driver.find_element(By.ID, "loginPassword").send_keys("yy")
driver.find_element(By.ID, "loginButton").click()
It is working fine for me and i'm not included any path and set property for chrome-extension. If i share this program,the opposite person is getting the following error and they have chromedriver.exe in python folder and in that same folder they created this python file
Traceback (most recent call last): File "C:\Users\1025043\AppData\Local\Programs\Python\Python37-32\anu\1.py", line 8, in driver = webdriver.Chrome(chrome_driver_path) NameError: name 'chrome_driver_path' is not defined
In my path i am having,
['', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\python37.zip', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\DLLs', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\lib', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\lib\site-packages', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\lib\site-packages\win32', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\lib\site-packages\win32\lib', 'C:\Users\1024983\AppData\Local\Programs\Python\Python37\lib\site-packages\Pythonwin']
What is the reason for this.?
Note: I am using Windows 10, Python 3.7.4 ,selenium 3.141.0 ,Chrome Version 78.0.3904.108(opposite person also using this version only)
chromedriver.exeneeds to be in the path, it is in your computer so it works. - Guychromedriverto the project and include relative path to it. - Guy