Once after selecting the value in "Country", the web page might be taking more time to load "State" drop-down. I am not sure if the whole page is getting reloaded in this case, (or) may be some script is just refreshing only the "state" drop-down, in which case "waitforpageload" may not work.
In any case, can you try running your script in "Slow" mode? that might help.
thanks.
prithivi wrote:
Hi all
I am very new to selenium. I am getting some problem while selecting an item from drop down list box.
Actually , I need to select an item from the drop down list box Country, the State drop down list box will load all the states for the selected country. I need to select a State from the State drop down list box.
Here my code works to select country but it doesn't select the state. The mystery is sometimes it works and sometimes it doesn't.
I even introduced waitforpageload for 1 minute and even more than that , I get the message timed out after 60000ms.
selenium.select("form1:Country", Country);
selenium.waitForPageToLoad("60000");
selenium.select("form1:State", State);
I get the below message for this code
com.thoughtworks.selenium.SeleniumException: Timed out after 60000ms
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.waitForPageToLoad(DefaultSelenium.java:635)
at com.testscripts.ManageTrust.Create(ManageTrust.java:38)
at com.testscripts.ManageTrust.setUp(ManageTrust.java:18)
at com.testscripts.ManageTrust.main(ManageTrust.java:171)
selenium.select("form1:Country", Country);
selenium.select("form1:State", State);
If I remove the wait, I am getting the below mentioned error message.
com.thoughtworks.selenium.SeleniumException: ERROR: Option with label 'Kerala' not found
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.select(DefaultSelenium.java:315)
at com.testscripts.ManageTrust.Create(ManageTrust.java:138)
at com.testscripts.ManageTrust.setUp(ManageTrust.java:18)
at com.testscripts.ManageTrust.main(ManageTrust.java:170)
Can someone help me?