Skip to content Skip to sidebar Skip to footer

How Can I Wait For An Element Will Be Visible Then Be Clicked In Python Selenium Webdriver?

In odoo I have written code to click on the send button that is browser.find_element_by_xpath('//span[.='Send']').click() After this send button is clicked , then I have to click

Solution 1:

You have to import the webdriver wait module. you can do something like the example below. Read more abut waits at Waits

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

wd = webdriver.Chrome(executable_path="your/path/to/chromedriver")

# Access website

wait = WebDriverWait(wd, 10)
confirm = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[.='Confirm Sale']")))
confirm.click()

Post a Comment for "How Can I Wait For An Element Will Be Visible Then Be Clicked In Python Selenium Webdriver?"