Open hiransasidharan opened 1 year ago
@hiransasidharan Try to use wait https://www.selenium.dev/documentation/webdriver/waits/#implicit-wait
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def click_element_in_toolbar(self, element_index):
review_window_toolbar = self.driver.find_element_by_accessibility_id(REVIEW_WINDOW_TOOLBAR_ID)
wait = WebDriverWait(review_window_toolbar, 10)
review_window_toolbar_children = wait.until(EC.presence_of_all_elements_located((By.XPATH, ALL_CHILDREN_PATH)))
while len(review_window_toolbar_children) < element_index:
review_window_toolbar_children = wait.until(EC.presence_of_all_elements_located((By.XPATH, ALL_CHILDREN_PATH)))
time.sleep(2)
review_window_toolbar_children[element_index].click()
Hello,
I am facing this issue when the following code is being executed. But this is not consistent. Sometimes the element is returned with no error. Sometimes the error is throwing. We are using pytest and WinAppDriver for automation of a win32 application.
Using :