private boolean fireEvent ( Eventable eventable ) { Eventable eventToFire = eventable ; if ( eventable . getIdentification ( ) . getHow ( ) . toString ( ) . equals ( "xpath" ) && eventable . getRelatedFrame ( ) . equals ( "" ) ) { eventToFire = resolveByXpath ( eventable , eventToFire ) ; } boolean isFired = false ; try { isFired = browser . fireEventAndWait ( eventToFire ) ; } catch ( ElementNotVisibleException | NoSuchElementException e ) { if ( crawlRules . isCrawlHiddenAnchors ( ) && eventToFire . getElement ( ) != null && "A" . equals ( eventToFire . getElement ( ) . getTag ( ) ) ) { isFired = visitAnchorHrefIfPossible ( eventToFire ) ; } else { LOG . debug ( "Ignoring invisible element {}" , eventToFire . getElement ( ) ) ; } } catch ( InterruptedException e ) { LOG . debug ( "Interrupted during fire event" ) ; interruptThread ( ) ; return false ; } LOG . debug ( "Event fired={} for eventable {}" , isFired , eventable ) ; if ( isFired ) { // Let the controller execute its specified wait operation on the browser thread safe. waitConditionChecker . wait ( browser ) ; browser . closeOtherWindows ( ) ; return true ; } else { /* * Execute the OnFireEventFailedPlugins with the current crawlPath with the crawlPath * removed 1 state to represent the path TO here. */ plugins . runOnFireEventFailedPlugins ( context , eventable , crawlpath . immutableCopyWithoutLast ( ) ) ; return false ; // no event fired } }
Try to fire a given event on the Browser .