All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimus.core.web.WebLauncher Maven / Gradle / Ivy

Go to download

Optimus Lite API to manage test devices and create appium driver based on platform

There is a newer version: 0.1.7-beta
Show newest version
package com.testvagrant.optimus.core.web;

import com.testvagrant.optimus.core.models.web.SiteConfig;
import com.testvagrant.optimus.core.models.web.WebDriverDetails;
import org.awaitility.Awaitility;

import java.time.Duration;

public class WebLauncher {

  public void launch(SiteConfig siteConfig, WebDriverDetails webDriverDetails) {
    webDriverDetails.getDriver().get(siteConfig.getUrl());
    for (int retry = 0; retry < 3; retry++) {
      try {
        Awaitility.await()
            .atMost(Duration.ofMinutes(1))
            .until(
                () ->
                    webDriverDetails
                        .getDriver()
                        .getTitle()
                        .toLowerCase()
                        .contains(siteConfig.getTitle().toLowerCase()));
        break;
      } catch (Exception e) {
        webDriverDetails.getDriver().navigate().refresh();
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy