List of usage examples for org.openqa.selenium.remote SessionId toString
@Override
public String toString()
From source file:com.thoughtworks.selenium.webdriven.WebDriverBackedSeleniumServlet.java
License:Apache License
private void startNewSession(HttpServletResponse resp, String browserString, String baseUrl, String options) throws IOException { SessionId sessionId = null; if (options.startsWith("webdriver.remote.sessionid")) { // We may have a hit List<String> split = Splitter.on("=").omitEmptyStrings().trimResults().limit(2).splitToList(options); if (!"webdriver.remote.sessionid".equals(split.get(0))) { getServletContext()/*from ww w. j ava 2s . co m*/ .log("Unable to find existing webdriver session. Wrong parameter name: " + options); sendError(resp, "Unable to find existing webdriver session. Wrong parameter name: " + options); return; } if (split.size() != 2) { getServletContext().log("Attempted to find webdriver id, but none specified. Bailing"); sendError(resp, "Unable to find existing webdriver session. No ID specified"); return; } sessionId = new SessionId(split.get(1)); } if (sessionId != null) { Session session = sessionsSupplier.get().get(sessionId); // Let's assume the person knew what they're doing... Skip to the end } else { // Fine. Let's see if the user chose "webdriver" or something specific. DesiredCapabilities caps; switch (browserString) { case "*webdriver": caps = new DesiredCapabilities(); break; case "*chrome": case "*firefox": case "*firefoxproxy": case "*firefoxchrome": case "*pifirefox": caps = DesiredCapabilities.firefox(); break; case "*iehta": case "*iexplore": case "*iexploreproxy": case "*piiexplore": caps = DesiredCapabilities.internetExplorer(); break; case "*googlechrome": caps = DesiredCapabilities.chrome(); break; case "*MicrosoftEdge": caps = DesiredCapabilities.edge(); break; case "*opera": case "*operablink": caps = DesiredCapabilities.operaBlink(); break; case "*safari": case "*safariproxy": caps = DesiredCapabilities.safari(); break; default: sendError(resp, "Unable to match browser string: " + browserString); return; } try { sessionId = sessionsSupplier.get().newSession(caps); } catch (Exception e) { getServletContext().log("Unable to start session", e); sendError(resp, "Unable to start session. Cause can be found in logs. Message is: " + e.getMessage()); return; } } Session session = sessionsSupplier.get().get(sessionId); if (session == null) { getServletContext().log("Attempt to use non-existant session: " + sessionId); sendError(resp, "Attempt to use non-existant session: " + sessionId); return; } WebDriver driver = session.getDriver(); CommandProcessor commandProcessor = new WebDriverCommandProcessor(baseUrl, driver); SESSIONS.put(sessionId, commandProcessor); sendResponse(resp, sessionId.toString()); }
From source file:org.cybercat.automation.core.Browser.java
License:Apache License
public String getSessionId() { SessionId sessionId = driver.getSessionId(); return sessionId == null ? "-1" : sessionId.toString(); }
From source file:org.jboss.arquillian.drone.webdriver.factory.remote.reusable.ReusedSession.java
License:Apache License
public ReusedSession(SessionId sessionId, Capabilities capabilities) { this.opaqueKey = sessionId.toString(); this.capabilities = capabilities; }
From source file:org.uiautomation.ios.client.uiamodels.impl.AttachRemoteIOSDriver.java
License:Apache License
public AttachRemoteIOSDriver(URL url, SessionId session) { super(url, null); setCommandExecutor(new HttpCommandExecutor(url)); setSessionId(session.toString()); }
From source file:org.uiautomation.ios.client.uiamodels.impl.AttachRemoteUIADriver.java
License:Apache License
public AttachRemoteUIADriver(URL url, SessionId session) { super(url, null); setCommandExecutor(new HttpCommandExecutor(url)); setSessionId(session.toString()); }
From source file:org.uiautomation.ios.communication.Path.java
License:Apache License
public Path withSession(SessionId sessionId) { validateAndReplace(SESSION_ID, sessionId.toString()); return this; }