org.openqa.grid.selenium.proxy
Class WebDriverRemoteProxy

java.lang.Object
  extended by org.openqa.grid.internal.RemoteProxy
      extended by org.openqa.grid.selenium.proxy.WebRemoteProxy
          extended by org.openqa.grid.selenium.proxy.WebDriverRemoteProxy
All Implemented Interfaces:
java.lang.Comparable<RemoteProxy>, CommandListener, SelfHealingProxy, TestSessionListener, TimeoutListener

public class WebDriverRemoteProxy
extends WebRemoteProxy
implements TestSessionListener


Field Summary
 
Fields inherited from class org.openqa.grid.internal.RemoteProxy
remoteURL
 
Constructor Summary
WebDriverRemoteProxy(RegistrationRequest request, Registry registry)
           
 
Method Summary
 void afterSession(TestSession session)
          Will be run after the last command is forwarded, but before the proxy slot is released.
 void beforeRelease(TestSession session)
          Gives a chance to clean the resources on the remote when the session has timed out.
 void beforeSession(TestSession session)
          Will be run after the proxy slot is reserved for the test, but before the first command is forwarded to the remote.
 
Methods inherited from class org.openqa.grid.selenium.proxy.WebRemoteProxy
addNewEvent, afterCommand, beforeCommand, getHtmlRender, getNewSession, isAlive, isDown, onEvent, startPolling, stopPolling
 
Methods inherited from class org.openqa.grid.internal.RemoteProxy
compareTo, equals, getCapabilityHelper, getConfig, getId, getMaxNumberOfConcurrentTestSessions, getNewInstance, getOriginalRegistrationRequest, getRegistry, getRemoteURL, getTestSlots, getTimeOut, getTotalUsed, hashCode, isBusy, setCapabilityHelper, setId, teardown, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebDriverRemoteProxy

public WebDriverRemoteProxy(RegistrationRequest request,
                            Registry registry)
Method Detail

beforeRelease

public void beforeRelease(TestSession session)
Description copied from interface: TimeoutListener
Gives a chance to clean the resources on the remote when the session has timed out.

Is executed before the session is released to the hub. If an exception is thrown, the slot that was associated with the session is considered corrupted and won't be released for future use.

You can check session.getInternalKey before timing out. internalkey==null usually means the initial POST /session hasn't been completed yet.For instance if you use web driver, that means the browser is in the process of being started. During that state, you can't really clean the resources properly.

Specified by:
beforeRelease in interface TimeoutListener
Specified by:
beforeRelease in class WebRemoteProxy

beforeSession

public void beforeSession(TestSession session)
Description copied from interface: TestSessionListener
Will be run after the proxy slot is reserved for the test, but before the first command is forwarded to the remote.

Gives a chance to do a setup on the remote before the test start.

WARNING : beforeSession should NOT throw exception. If an exception is thrown, the session is considered invalid and the resources will be freed.

Specified by:
beforeSession in interface TestSessionListener
See Also:
if the setup applies to all the tests.

afterSession

public void afterSession(TestSession session)
Description copied from interface: TestSessionListener
Will be run after the last command is forwarded, but before the proxy slot is released.

If the test crashes before a session is provided by the remote, session.externalKey will be null.

WARNING : after session should NOT throw exception. If an exception is thrown, the resources will NOT be released, as it could mean the remote is now corrupted.

Specified by:
afterSession in interface TestSessionListener


Copyright © 2011. All Rights Reserved.