After about a month of creating and ironing out my Selenium automated tests, I finally added it to a Jenkins pipeline. I didn't expect it to succeed on the first try, but I didn't expect to get errors I've never had happen before, after running these tests hundreds of times.
Suddenly I'm getting stale element errors from an element that just became visible and was just referenced.
# Wait until table shows up WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="popup-modal-container"]/div/div/div/table/tbody/tr/td'))) # Interact with checkboxes check_checkbox = self.driver.find_element_by_xpath('//*[@id="popup-modal-container"]/div/div/div/table/tbody/tr/td') check_checkbox.click()
Like in this code here, I'm getting a staleness error thrown on
check_checkbox.click() despite waiting for the html element it's on to be fully present and rendered. Nothing happens to that element until I've told Selenium to click the checkbox. But it's being called stale by Selenium.
In the meantime, I've added an expected condition to wait for that element to be visible, but I doubt that will be more than a hotfix due to all the staleness errors that are suddenly being thrown.
hover_over = WebDriverWait(self.driver, 30).until(ec.visibility_of_element_located((By.ID, 'pl-item-enrollment'))) hover = ActionChains(self.driver).move_to_element(hover_over) hover.perform()
In the above code, I'm getting a staleness error on the
hover.perform(). Similarly, it was just made visible and just referenced, but it's considered stale. Why? I've never gotten this issue before with my navigation tests.
Advising me how to avoid this sudden staleness or getting Jenkins to actually run the browser would be appreciated, thank you.