Selenium Java~ Not deleting cookies as expected -


i trying automate testing webapp using selenium java/firefox eclipse plugin. trying make payment , delete cookies, remove stored information. reason doesnt not work.

public void validationcards(bufferedwriter out){     outfile = out;     arraylist<string> methodlist = new arraylist<string>();     methodlist.add("validationvisafrench");     methodlist.add("validationmcfrench");     methodlist.add("validationdiscoverfrench");     methodlist.add("validationdinerclubfrench");     methodlist.add("validationjcbfrench");     method method = null;      for(string testtorun:methodlist){         try{             method = this.getclass().getmethod(testtorun);         }catch(nosuchmethodexception e){             system.out.println("this failed horribly");             e.printstacktrace();         }catch(runtimeexception ex){             ex.printstacktrace();         }catch (exception e) {             e.printstacktrace();         }          try{             ppsctests tempobj = this;             this.testdriver.manage().deleteallcookies();             method.invoke(tempobj);             this.testdriver.manage().deleteallcookies();         }catch (exception e) {             system.out.println("cant invoke method shits , giggles");             e.printstacktrace();         }     } } 

this sample of 1 of tests trying run:

public void validationmcfrench(){     system.out.println("mc french stored card");     this.testdriver.manage().deleteallcookies();     payment("5555555555554444", "frenchquery");      testselenium.waitforpagetoload("20000");     string source = jsoup.parse(testdriver.getpagesource()).text();     system.out.println("validationmcfrench: "+source);     successorfail(source, "validationmcfrench", "example");      this.testdriver.manage().deleteallcookies(); } 

but doesnt seem cookies deleted. kinda stuck. appreciated.

so deleteallcookies() thing didnt work. neither did deleteallvisiblecookies(). went creating new instance of webdriver payment method.

public void payment(string ccnumber, string querytype){     webdriver drivertest = new firefoxdriver(profile);     this.testdriver = drivertest; //then assigning local webdriver     if(querytype.equals("query"))         testdriver.get(testurl + query());     else if(querytype.equals("queryclean"))         testdriver.get(testurl + queryclean());     else {         system.out.println(testurl + frenchquery());         testdriver.get(testurl + frenchquery());     }     testselenium.waitforpagetoload("7000");     webelement ccelement1 = null;     webelement ccexpiryelement = null;      ccelement1 = testdriver.findelement(by.id("ccnumber"));     ccexpiryelement = testdriver.findelement(by.id("ccexpirydate"));      webelement cvv2element1 = testdriver.findelement(by.name("cccvv2"));     ccelement1.sendkeys(ccnumber);     ccexpiryelement.sendkeys("1112");//mmyy     cvv2element1.sendkeys("1111");     webelement submit = testdriver.findelement(by.id("onetouchsubmit"));     submit.submit();     testselenium.waitforpagetoload("10000");     //drivertest.close(); } 

its not elegant solution works needed do. creating new instance works same deleting cookies.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -