protected static class SearchObject.DefaultJSEventListener extends java.lang.Object implements SearchObject.GenericJSEventListener
String event = "mousedown"; int timeout = 1000;//milliseconds DefaultJSEventListener listener = new DefaultJSEventListener(event); //add listener for event String listenerID = WDLibrary.addJavaScriptEventListener(webelement, event, listener); //do some mousedown related work, for example 'click' webelement.click(); //wait for event happen if(listener.waitEventFired(timeout)){ //ok, event has been fired.} //remove the listener WDLibrary.removeJavaScriptEventListener(webelement, event, listenerID);History:
EVENT_JS_click, EVENT_JS_MOUSEDOWN, EVENT_JS_MOUSEUP, TIMEOUT_WAIT_FOR_EVENT_MOUSEDOWN
Constructor and Description |
---|
DefaultJSEventListener() |
DefaultJSEventListener(java.lang.String eventName) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getEventName() |
boolean |
isEventFired() |
void |
onEventFired() |
void |
setEventFired(boolean eventFired) |
void |
setEventName(java.lang.String eventName) |
boolean |
waitEventFired(long timeout) |
public DefaultJSEventListener()
public DefaultJSEventListener(java.lang.String eventName)
public boolean isEventFired()
public void setEventFired(boolean eventFired)
public java.lang.String getEventName()
public void setEventName(java.lang.String eventName)
public void onEventFired()
onEventFired
in interface SearchObject.GenericJSEventListener
public boolean waitEventFired(long timeout)
timeout
- long, time to wait for the event fired. in milliseconds.Copyright © SAS Institute. All Rights Reserved.