Esempio n. 1
0
 public boolean ensurejQuery() throws IOException {
   if ((Boolean)
       js.executeScript("return typeof window[arguments[0]] != typeof __undefined", getRef())) {
     return false;
   }
   InputStream is = getClass().getClassLoader().getResourceAsStream(getUrl());
   js.executeScript(IOUtils.readFully(is));
   is.close();
   js.executeScript("window[arguments[0]] = jQuery.noConflict(true)", getRef());
   return true;
 }
 private void stream_classpath_resource_to_file(
     String path_to_classpath_resource, String file_to_write) {
   InputStream stream = DefaultHtmlReporter.class.getResourceAsStream(path_to_classpath_resource);
   try {
     String contents = IOUtils.readFully(stream);
     FileUtils.writeStringToFile(new File(file_to_write), contents);
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }