@NotNull private static RemoteWebDriver setupDriverFromRule(BrowserWebDriverContainer rule) { RemoteWebDriver driver = rule.getWebDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); return driver; }
@Bean(destroyMethod = "quit") public ChromeDriver webDriver() { System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log"); System.setProperty("webdriver.chrome.verboseLogging", "true"); ChromeOptions options = new ChromeOptions(); options.addArguments( "--verbose", "--headless", "--disable-web-security", "--ignore-certificate-errors", "--allow-running-insecure-content", "--allow-insecure-localhost", "--no-sandbox", "--disable-gpu" ); LoggingPreferences logs = new LoggingPreferences(); logs.enable(LogType.PERFORMANCE, Level.ALL); options.setCapability(CapabilityType.LOGGING_PREFS, logs); options.setAcceptInsecureCerts(true); ChromeDriver driver = new ChromeDriver(options); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS); driver.manage().timeouts().setScriptTimeout(15, TimeUnit.SECONDS); driver.manage().window().setSize(new Dimension(1024, 768)); return driver; }
public RemoteWebDriver webDriver() { final RemoteWebDriver driver = webDriver(environment.getProperty("selenium.browser")); driver.manage().timeouts().implicitlyWait(webDriverWaitTimeout(), TimeUnit.SECONDS); driver.manage().window().maximize(); return driver; }
/** * Restores implicit timeout to the value defined in the {@link Timings} instance. */ protected void restoreImplicitTimeout() { webDriverProvider.get().manage().timeouts() .implicitlyWait(timings.getImplicitTimeout(), TimeUnit.SECONDS); }
private void setImplicitTimeoutsIfSpecified(WebDriver driver) { if (ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT.isDefinedIn(environmentVariables)) { int timeout = environmentVariables.getPropertyAsInteger(ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT .getPropertyName(),0); driver.manage().timeouts().implicitlyWait(timeout, TimeUnit.MILLISECONDS); } }
private WebDriver getDefaultWebDriver() { if (webDriver == null) { webDriver = new ChromeDriver(); webDriver.manage().timeouts().implicitlyWait(implicitWait, TimeUnit.MILLISECONDS); } return webDriver; }
/** * Forces the passed driver to wait for a {@link #getTimeout()} number of seconds when looking up page elements * before declaring that it cannot find them. */ public void setDriverImplicitWait(WebDriver driver) { driver.manage().timeouts().implicitlyWait(getTimeout(), TimeUnit.SECONDS); }
@Override public WebDriver getDriver() { SafariDriver safariDriver = new SafariDriver(); safariDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); safariDriver.manage().window().setSize(new Dimension(dimX, dimY)); return safariDriver; }
private void setImplicitTimeoutsIfSpecified(WebDriver driver) { if (ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT.isDefinedIn(environmentVariables)) { int timeout = environmentVariables.getPropertyAsInteger(ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT .getPropertyName(),0); driver.manage().timeouts().implicitlyWait(timeout, TimeUnit.MILLISECONDS); } }
/** * Sets implicit timeout to {@value Timings#NEAR_ZERO} milliseconds. */ protected void setImplicitTimeoutToNearZero() { webDriverProvider.get().manage().timeouts().implicitlyWait(Timings.NEAR_ZERO, TimeUnit.SECONDS); }
public void resetTimeouts(WebDriver proxiedDriver) { Duration currentTimeout = currentTimeoutFor(proxiedDriver); if (timeoutStack.containsTimeoutFor(proxiedDriver)) { Duration previousTimeout = timeoutStack.popTimeoutFor(proxiedDriver).or(getDefaultImplicitTimeout()); if ((currentTimeout != previousTimeout) && isNotAMocked(proxiedDriver)) { proxiedDriver.manage().timeouts().implicitlyWait(previousTimeout.in(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS); } } }
public void setTimeouts(WebDriver proxiedDriver, Duration implicitTimeout) { Duration currentTimeout = currentTimeoutFor(proxiedDriver); timeoutStack.pushTimeoutFor(proxiedDriver, implicitTimeout); if ((implicitTimeout != currentTimeout) && isNotAMocked(proxiedDriver)) { proxiedDriver.manage().timeouts().implicitlyWait(implicitTimeout.in(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS); } }
private WebDriver buildSaucelabsDriver() throws MalformedURLException { String saucelabsUrl = sauceRemoteDriverCapabilities.getUrl(); WebDriver driver = webdriverInstanceFactory.newRemoteDriver(new URL(saucelabsUrl), findSaucelabsCapabilities()); if (isNotEmpty(ThucydidesSystemProperty.SAUCELABS_IMPLICIT_TIMEOUT.from(environmentVariables))) { int implicitWait = ThucydidesSystemProperty.SAUCELABS_IMPLICIT_TIMEOUT.integerFrom(environmentVariables, 30); driver.manage().timeouts().implicitlyWait(implicitWait, TimeUnit.SECONDS); } return driver; }
private void setDriverImplicitTimeout(Duration implicitTimeout) { if (driver instanceof ConfigurableTimeouts) { ((ConfigurableTimeouts) driver).setImplicitTimeout(implicitTimeout); } else { driver.manage().timeouts().implicitlyWait(implicitTimeout.in(MILLISECONDS), MILLISECONDS); } }
public Duration resetTimeouts(WebDriver proxiedDriver) { Duration currentTimeout = currentTimeoutFor(proxiedDriver); if (!timeoutStack.containsTimeoutFor(proxiedDriver)) { return currentTimeout; } timeoutStack.popTimeoutFor(proxiedDriver); Duration previousTimeout = currentTimeoutFor(proxiedDriver);//timeoutStack.popTimeoutFor(proxiedDriver).or(getDefaultImplicitTimeout()); if ((currentTimeout != previousTimeout) && isNotAMocked(proxiedDriver)) { proxiedDriver.manage().timeouts().implicitlyWait(previousTimeout.toMillis(), TimeUnit.MILLISECONDS); } return previousTimeout; }
/** * Forces the driver to wait for passed number of seconds when looking up page elements before declaring that it * cannot find them. */ public void setDriverImplicitWait(int timeout) { manage().timeouts().implicitlyWait(timeout, TimeUnit.SECONDS); }
public WebElement findElementWithoutWaiting(WebElement element, By by) { // Temporarily remove the implicit wait on the driver since we're doing our own waits... manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); try { return element.findElement(by); } finally { setDriverImplicitWait(); } }
public List<WebElement> findElementsWithoutWaiting(By by) { // Temporarily remove the implicit wait on the driver since we're doing our own waits... manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); try { return findElements(by); } finally { setDriverImplicitWait(); } }
private static void initDriver() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability("appPackage", "com.android.settings"); capabilities.setCapability("appActivity", "Settings"); driver = new AndroidDriver<>(service.getUrl(), capabilities); driver.manage().timeouts().implicitlyWait(15, SECONDS); }
private void setUpWebDriver() { ChromeOptions options = new ChromeOptions(); options.addArguments("headless"); options.addArguments("no-sandbox"); options.addArguments("window-size=1200x600"); driver = new ChromeDriver(options); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(300, TimeUnit.SECONDS); }