Esempio n. 1
0
 // TODO this requires redesign for writables
 public static boolean perform(WebHandle handle, WebDriver driver) {
   WebElement we = handle.findElement(driver);
   if (we == null) {
     // TODO this place strongly interferes with driver's implicitly wait. So, I think, personal
     // fails counter per handle needed.
     log.error(
         handle.url.graphUrl()
             + " | "
             + handle.xpath
             + "\n"
             + "Unable to .perform(WebDriver), cause search of element by stored selector is failed.");
     return false;
   }
   if (!we.isDisplayed() || !we.isEnabled()) {
     log.error(
         handle.url.graphUrl()
             + " | "
             + handle.xpath
             + "\n"
             + "Failed to .perform(WebDriver), cause element not displayed or not enabled.");
     return false;
   }
   switch (handle.eltype) {
     case clickable:
       we.click();
       break;
       //            case writable: we.sendKeys(context); break;
     case terminal:
       if (handle.isRoot()) return true;
       assert false : "terminal elements was touched";
       break;
     default:
       assert false : "this shouldn't have happened???";
       break;
   }
   return true;
 }
Esempio n. 2
0
 /** Just a constructor. Fills hash field. */
 private Event(WebHandle handle, String context) {
   this.handle = handle;
   this.context = context;
   hash = handle.hashCode() + Utils.hashString(context) * 239;
 }
Esempio n. 3
0
 /** Factory method for convenient creating of root element. Will be terminal */
 public static Event createRoot(String url) {
   return create(WebHandle.createRootHandle(new JetURL(url)), "");
 }
Esempio n. 4
0
 @Override
 public boolean equals(Object obj) {
   return obj instanceof Event
       && context.equals(((Event) obj).context)
       && handle.equals(((Event) obj).handle);
 }