Esempio n. 1
0
 private boolean isDownloadWorking(AjaxSelenium s, XPathLocator xp, String textToFind) {
   AttributeLocator<XPathLocator> al = xp.getAttribute(Attribute.HREF);
   try {
     URL downloadUrl = new URL(contextPath + s.getAttribute(al));
     BufferedReader r = new BufferedReader(new InputStreamReader(downloadUrl.openStream()));
     String str;
     StringBuffer sb = new StringBuffer();
     while ((str = r.readLine()) != null) {
       sb.append(str);
     }
     return sb.toString().contains(textToFind);
   } catch (IOException e) {
     return false;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.jboss.arquillian.ajocado.locator.CompoundableLocator#getDescendant
  * (org.jboss.arquillian.ajocado.locator.CompoundableLocator)
  */
 @Override
 public XPathLocator getDescendant(XPathLocator elementLocator) {
   return new XPathLocator(
       SimplifiedFormat.format("{0}//{1}", getRawLocator(), elementLocator.getRawLocator()));
 }