Selenium Firefox Open timeout

前端 未结 3 1039
情歌与酒
情歌与酒 2021-01-03 02:32

Using Windows 2008, C#, Firefox 3.5.1, Selenium RC (v1.0.1)

When it works, this code executes very quickly and the page loads within .5 seconds.

However, the

3条回答
  •  时光取名叫无心
    2021-01-03 02:36

    I was facing the same problem .This is because open method of DefaultSelenium has timeout of 30000ms, so it waits for 30s for your page to load. You can try this trivial solution.

    //selenium is DefaultSelenium instance as private member of the class
    
                boolean serverStartTry = false;
            int tryCount =1;
    
            while((!serverStartTry) && tryCount <= Constants.maxServerTries){
                try{
                    this.selenium.open(ReadConFile.readcoFile("pageName"));
                    System.out.println("Server started in try no: "+tryCount);
                    serverStartTry =true;
                }catch (SeleniumException e) {
                    System.out.println("Server start try no: "+tryCount );
                    System.out.println("Server Start Try: "+ serverStartTry);
                    serverStartTry = false;
                    tryCount++;
                }
            }
            if(!serverStartTry){
                System.out.println("Server Not started, no. of attempts made: "+tryCount);
                System.exit(0);
            }
    

提交回复
热议问题