Java Code Examples for org.openqa.selenium.remote.RemoteWebDriver#getSessionId()
The following examples show how to use
org.openqa.selenium.remote.RemoteWebDriver#getSessionId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchContextWait.java From Selenium-Foundation with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected RuntimeException timeoutException(final String message, final Throwable lastException) { TimeoutException ex = new TimeoutException(message, lastException); ex.addInfo(WebDriverException.DRIVER_INFO, context.getClass().getName()); WebDriver driver = WebDriverUtils.getDriver(context); if (driver instanceof RemoteWebDriver) { RemoteWebDriver remote = (RemoteWebDriver) driver; if (remote.getSessionId() != null) { ex.addInfo(WebDriverException.SESSION_ID, remote.getSessionId().toString()); } if (remote.getCapabilities() != null) { ex.addInfo("Capabilities", remote.getCapabilities().toString()); } } throw ex; }
Example 2
Source File: BrowserStatement.java From neodymium-library with MIT License | 6 votes |
private boolean isWebDriverStillOpen(WebDriver webDriver) { if (webDriver == null) { return false; } try { RemoteWebDriver driver = (RemoteWebDriver) ((EventFiringWebDriver) webDriver).getWrappedDriver(); return driver.getSessionId() != null; } catch (Exception e) { LOGGER.warn("Couldn't detect if the WebDriver is still open!", e); return true; } }
Example 3
Source File: WebDriverWait.java From selenium with Apache License 2.0 | 6 votes |
@Override protected RuntimeException timeoutException(String message, Throwable lastException) { WebDriver exceptionDriver = driver; TimeoutException ex = new TimeoutException(message, lastException); ex.addInfo(WebDriverException.DRIVER_INFO, exceptionDriver.getClass().getName()); while (exceptionDriver instanceof WrapsDriver) { exceptionDriver = ((WrapsDriver) exceptionDriver).getWrappedDriver(); } if (exceptionDriver instanceof RemoteWebDriver) { RemoteWebDriver remote = (RemoteWebDriver) exceptionDriver; if (remote.getSessionId() != null) { ex.addInfo(WebDriverException.SESSION_ID, remote.getSessionId().toString()); } if (remote.getCapabilities() != null) { ex.addInfo("Capabilities", remote.getCapabilities().toString()); } } throw ex; }
Example 4
Source File: DockerRecordingJupiterTest.java From selenium-jupiter with Apache License 2.0 | 5 votes |
@Test public void testLatest( @DockerBrowser(type = CHROME, version = "76.0") RemoteWebDriver arg0) { arg0.get("https://bonigarcia.github.io/selenium-jupiter/"); assertThat(arg0.getTitle(), containsString("JUnit 5 extension for Selenium")); recordingFile = new File("testLatest_arg0_CHROME_76.0_" + arg0.getSessionId() + ".mp4"); }
Example 5
Source File: DockerHtmlVncJupiterTest.java From selenium-jupiter with Apache License 2.0 | 5 votes |
@Test public void testHtmlVnc( @DockerBrowser(type = CHROME, version = "76.0") RemoteWebDriver arg0) { arg0.get("https://bonigarcia.github.io/selenium-jupiter/"); assertThat(arg0.getTitle(), containsString("JUnit 5 extension for Selenium")); String folder = "target/surefire-reports/io.github.bonigarcia.seljup.test.docker.DockerHtmlVncJupiterTest"; htmlFile = new File(folder, "testHtmlVnc_arg0_CHROME_76.0_" + arg0.getSessionId() + ".html"); }
Example 6
Source File: W3CActions.java From selenium with Apache License 2.0 | 5 votes |
@Override public Void call() throws Exception { RemoteWebDriver driver = (RemoteWebDriver) getUnwrappedDriver(); CommandExecutor executor = (driver).getCommandExecutor(); long start = System.currentTimeMillis(); Command command = new Command(driver.getSessionId(), ACTIONS, allParameters); Response response = executor.execute(command); new ErrorHandler(true) .throwIfResponseFailed(response, System.currentTimeMillis() - start); return null; }