List of usage examples for org.openqa.selenium.remote SessionId SessionId
public SessionId(String opaqueKey)
From source file:org.jboss.arquillian.drone.webdriver.factory.remote.reusable.TestReusedSessionStoreImplSerialization.java
License:Apache License
@Test public void when_store_is_serialized_to_file_then_it_can_be_deserialized_and_reused() throws IOException { // given//w w w. j a v a 2 s.com ReusedSessionStoreImpl store = new ReusedSessionStoreImpl(); URL url = new URL("http://localhost/"); InitializationParameter key = new InitializationParameter(url, DesiredCapabilities.firefox()); ReusedSession session = new ReusedSession(new SessionId("opaqueKey"), DesiredCapabilities.firefox()); File tmpFile = null; try { // when tmpFile = File.createTempFile("graphene-filestore-test", ".ser"); store.store(key, session); fileStore.writeStoreToFile(tmpFile, store); // then ReusedSessionStore restoredStore = fileStore.loadStoreFromFile(tmpFile); assertNotNull(restoredStore); ReusedSession restoredSession = restoredStore.pull(key); assertEquals(session, restoredSession); } finally { if (tmpFile != null && tmpFile.exists()) { tmpFile.delete(); } } }
From source file:org.openqa.testing.StaticTestSessions.java
License:Apache License
public StaticTestSessions(Capabilities capabilities, WebDriver... drivers) { int sessionKeyFactory = 0; for (WebDriver driver : drivers) { SessionId sessionId = new SessionId(String.valueOf(sessionKeyFactory++)); sessionIdToDriver.put(sessionId, new TestSession(sessionId, driver, capabilities)); }/*from w ww . j a va2 s. c o m*/ freeSessions.addAll(sessionIdToDriver.keySet()); }
From source file:org.openqa.testing.TestSessions.java
License:Apache License
public SessionId newSession(Capabilities desiredCapabilities) throws Exception { SessionId sessionId = new SessionId(String.valueOf(sessionKeyFactory.getAndIncrement())); WebDriver driver = mock(WebDriver.class, "webdriver(" + sessionId + ")"); Session session = new TestSession(sessionId, driver, desiredCapabilities); sessionIdToDriver.put(sessionId, session); return sessionId; }
From source file:org.uiautomation.ios.inspector.model.IDESessionModelImpl.java
License:Apache License
public IDESessionModelImpl(Session session, URL remoteURL) { this.session = session; this.screenshot = new File(session.getSessionId() + ".png"); this.remoteEndPoint = remoteURL; driver = new ServerSideNativeDriver(remoteURL, new SessionId(session.getSessionId())); }
From source file:org.uiautomation.ios.server.ServerSideSession.java
License:Apache License
public void start() { instruments.startSession(getSessionId(), application, device, capabilities); // force stop session if running for too long final int sessionTimeoutMillis = options.getSessionTimeoutMillis(); stopSessionTimer.schedule(new TimerTask() { @Override//from ww w . ja va 2 s.c o m public void run() { log.warning("forcing stop session that has been running for " + sessionTimeoutMillis / 1000 + " seconds"); hardForceStop(); } }, sessionTimeoutMillis); URL url = null; try { url = new URL("http://localhost:" + driver.getHostInfo().getPort() + "/wd/hub"); } catch (Exception e) { e.printStackTrace(); } nativeDriver = new ServerSideNativeDriver(url, new SessionId(instruments.getSessionId())); if ("Safari".equals(capabilities.getBundleName())) { setMode(WorkingMode.Web); getRemoteWebDriver().get("about:blank"); } }