Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

View previous topic View next topic Go down

How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by prasad ginjupalli on Fri May 22, 2015 2:03 pm

Hi everyone,
We have recently started automating the Test Cases of our websites using Selenium Webdriver.
However we find that even though a test case has been correctly automated, it cannot be executed in a  reliable fashion:
-    Different parts of a website get loaded at different speeds (due to various factors like net traffic, server load etc.)
-    If the web-control (text box, frame etc..) has not yet loaded in the browser when Selenium starts to look for it, the script will simply fail with a message that the control was not found.
-    The solutions we have found so far on the internet is that we should increase the time that Selenium should wait till it starts looking for the control.
-    The trouble is that each time it seems to fail at a different point or control on the website.
-    This forces us to introduce a “thread.sleep()” statement at each and every step i.e. before  each click, text entry, item selection etc.
-    This however has the downside of hugely increasing the test execution time.

Any advice from you on this would be much appreciated.

prasad ginjupalli

Posts : 2
Join date : 2015-05-22

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by Job46 on Fri May 22, 2015 4:23 pm

Hello,
you can change the command 'click' by using 'clickAndWait' in the Selenium IDE.

Or you cant try "SeleniumUtils.WaitForElement(By./* you put your web control */, driver);

Ex: (C# code)

SeleniumUtils.WaitForElement(By.LinkText("test"), driver);

driver.FindElement(By.LinkText("test")).Click();

Job46

Posts : 3
Join date : 2015-05-22

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by prasad ginjupalli on Tue May 26, 2015 12:03 pm

Hi Job46,

Thank you for your advice.

we will try this and let you know results

prasad ginjupalli

Posts : 2
Join date : 2015-05-22

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by AgoBalan on Fri May 29, 2015 1:56 pm

Dear Job46,
please be careful wilreplying back to users,in your reply "SeleniumUtils.WaitForElement(By.LinkText("test"), driver);" 
is SeleniumUtils a method in  selenium or a class in your framework?,I think its a class in your framewrok there is no SeleniumUtils method in selenium,

New user will get confused so easily,they might look for SeleniumUtils method in selenium jar file

AgoBalan
Amateur
Amateur

Posts : 36
Join date : 2015-02-23

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by AgoBalan on Fri May 29, 2015 2:02 pm

dear prasad ginjupalli,
Always define your own  method  for all raw selenium command,for example insteasd of directlky using driver.click method,you should have your own defined method for click,

public void clickOnWEbElements(String strXpath){
int iMaximumTimeWait=30;
while(!iMaximumTimeWait=0){
  try{
  driver.findelement(By.xpath("passed xpath value")).click();
   break;
   }
  catch(Exception e){
  Thread.sleep(1000);
  iMaximumTimeWait=iMaximumTimeWait-1;
  }
}
if(iMaximumTimeWait==0){
"break execution";
}
}

AgoBalan
Amateur
Amateur

Posts : 36
Join date : 2015-02-23

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by Job46 on Fri May 29, 2015 5:15 pm

hey ! 
I finally tried something new using @AgoBalans code.
This is my version:

public void clickOnWEbElementsCAR(String strXpath)
        {
            countDown(By.XPath(strXpath));
        }


public void countDown(By by)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            while (stopwatch.ElapsedMilliseconds < 60000) // 1 min before timeOut
            {
                try
                {
                    driver.FindElement(by).Click();
                    break;
                }
                catch (Exception)
                {
                    // Ignore errors if unable to click
                }

            }
        }

Job46

Posts : 3
Join date : 2015-05-22

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by AgoBalan on Fri May 29, 2015 5:18 pm

Very Happy

AgoBalan
Amateur
Amateur

Posts : 36
Join date : 2015-02-23

Back to top Go down

Re: How to minimize test cases execution time Vs timeout failures in Selenium WebDriver

Post by Sponsored content Today at 3:20 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum