synchronization techniques

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

synchronization techniques

srinithya
can anyone explain me abt synchronization techniques in selenium webdriver?
Reply | Threaded
Open this post in threaded view
|

Re: synchronization techniques

softwaretestingforum
Administrator
Not quite sure what you are referring as Synchronization Techniques?
Are you referring to implicit and explicit wait in webdriver?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: synchronization techniques

illusion0reality
This post was updated on .
In reply to this post by srinithya
I suppose it is related to wait sort of things for fields.

For every field I interact, I use this function, I put the Thread.sleep:
I am sure, there maybe better ways to do this.


public static boolean verifyExistence(String fieldname, String pagename, String fname, String fvalue,int excelrc)
throws Exception
{ int vcounter=0;
try
{ Thread.sleep(4000);
String[] far=fieldname.split("=");

//First I verify whether the field eixsits, if NOT ONLY, I will wait for 10 seconds.
while(selenium.isElementPresent(fieldname)!=true) {
 try {
Thread.sleep(10);
vcounter=vcounter+10;


//this code should be modifed, otherwise won't work
/* String vexist=selenium.isElementPresent(fieldname)
if (vexist)
break;
*/


if ((vcounter>=70) & (selenium.isElementPresent(fieldname)!=true))
{
String faildescription = "Field does not exist on this page.";
GenericFunctions gf= new GenericFunctions();
gf.writePOI(failflag,pagename,far[1],far[0],excelrc,"c:\\resultsall.xls",faildescription);
gf=null;
AllVariables.exitTest=true;
break;
}
}
catch (Exception e)
{}
} // while loop
}
catch(Exception e)
{System.out.println(e.toString());}
return selenium.isElementPresent(fieldname);
}