how to get HTML5 Application Cache Status by Selenium/Java -


how html5 application cache status selenium/java

for selenium/java programming, how can selenium/java status of html5 application cache status? tried below, didn't work. "cannot cast org.openqa.selenium.html5.applicationcache.."

import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.html5.appcachestatus; import org.openqa.selenium.html5.applicationcache;  public class html5appcache {      public void testhtml5localstorage() throws exception {          webdriver driver = new firefoxdriver();          driver.get("http://www.w3schools.com/html/tryhtml5_html_manifest.htm");          appcachestatus status = ((applicationcache) (driver)).getstatus();      }  } 

you casting short appcachestatus object below, hence error.

  appcachestatus status = ((applicationcache) (driver)).getstatus(); 

applicationcache interface have write own version of getstatus method.

you may want cache status using javascriptexecutor. hope helps.

javascriptexecutor jsexecutor = (javascriptexecutor) driver; long cachestatus = (long) jsexecutor.executescript("return  window.applicationcache.status;"); system.out.println(cachestatus); 

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -