I am using Selenium IDE to make a automation scripts. In my code there is a page where when i select some options the 'Next' button gets disabled for a while. I have used a 'pause' statement for the time when the button is disabled but when i re-run my scripts in Selenium IDE, the 'Next' button does not get clicked most of the time. Does anyone have any solution for this sort of a problem?
2 Answers
Use webdriverWait and ExpectedConditions:
from selenium2.webdriver.common.by import By
from selenium2.webdriver.support.ui import WebDriverWait
from selenium2.webdriver.support import expected_conditions as EC
WebDriverWait(driver, WAIT).until(EC.element_to_be_clickable((By.ID, id)))
-
I am using Selenium IDE for now! And i have used the pause statement but still doesn't work. Sep 18, 2014 at 6:32
-
You may add longer wait, but it will waste more time when response is faster, making test slower. And it still might fail sometimes - just less often. Reason why people use webdriver and not Se IDE is better control. Good luck! Sep 18, 2014 at 18:30
-
Adding a wait doesnot help at all. i cant figure out whats wrong. Sep 19, 2014 at 7:18
Have you tried adding the Selenium IDE: Implicit Wait add-on? It might give you what you are looking for.
"This plugin allows Selenium IDE to automatically wait until the element is found before executing each command using a locator. It is equivalent to the implicit wait function available with Selenium 2 WebDrivers."
https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-implicit-wait/
-
I think my 'Next' button does get executed as all the next operations run successfully. Its just that the next page doesn't appear on my screen. Sep 22, 2014 at 6:53
-
The 'Next" does get executed and clicked i guess because the next operations are executed successfully. and when i hit the next button for the first time manually then it does click on it and navigate to the next page everyother time. Sep 22, 2014 at 7:05