Mar-26-2020, 09:08 AM
Hello guys, I dont understand why this is not working.
If I use this, works
And if I use this is not working
The erro is in the line: driver.find_element_by_xpath(f[i]).click()
If I use this, works
def my_function(i): while i<a: print(f[i]) i=i+1 pass pass my_function(0)
And if I use this is not working
def init_driver(): driver=webdriver.Firefox(executable_path="C:\\Users\\Sabrina\\Desktop\\geckodriver-v0.26.0-win64\\geckodriver.exe") driver.wait=WebDriverWait(driver, 5) driver.get("www link") return driver def my_function(i,driver): while i<a: element=driver.wait.until(EC.presence_of_element_located((By.XPATH,f[i])) driver.find_element_by_xpath(f[i]).click() ^ SyntaxError: invalid syntax element1=driver.wait.until(EC.presence_of_element_located((By.XPATH,g[i]))) driver.find_element_by_xpath(g[i]).click() import time time.sleep(2) driver.back() print(f[i]) i=i+1 pass pass driver=init_driver() my_function(0,driver)
The erro is in the line: driver.find_element_by_xpath(f[i]).click()