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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -