Test have multiple clicks which redirect to other page so I added some explicit waits there but when test is executed Selenium ignores one of two waits and performs click. And only then explicit wait performs when it already next page loaded and of course raises TimeoutException because it unable to locate element there. Also I need to mention that sometimes test executes properly but I think it's because the page has loaded in time.
def test_two(browser):
browser.get('http://localhost/index.php?route=common/home&language=en-gb')
macbook = browser.find_element(By.CSS_SELECTOR, "#content > div.row > div:nth-child(1) > form > div > div.content > div.button-group > button:nth-child(3)")
iphone = browser.find_element(By.CSS_SELECTOR, "#content > div.row > div:nth-child(2) > form > div > div.content > div.button-group > button:nth-child(3)")
browser.execute_script("arguments[0].click();", macbook)
browser.execute_script("arguments[0].click();", iphone)
browser.get('http://localhost/index.php?route=product/compare&language=en-gb')
delete_macbook = WebDriverWait(browser, 3).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#content > table > tbody:nth-child(7) > tr > td:nth-child(2) > form > a")))
browser.execute_script("arguments[0].click();", delete_macbook)
delete_iphone = WebDriverWait(browser, 3).until(EC.presence_of_element_located((By.LINK_TEXT, "Remove")))
browser.execute_script("arguments[0].click();", delete_iphone)
I also tried to run this test in Firefox (initially it was Chrome) and it met each explicit wait correctly. So can it be browser or driver issue?
-written by newbie