Search in sources :

Example 1 with NgWebDriver

use of com.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class ProtractorDriver method init.

@Before
public void init() throws MalformedURLException {
    log.info("Launching (protractor) in " + browser + "...");
    DesiredCapabilities capabilities = null;
    if (browser.toLowerCase().equals("firefox")) {
        capabilities = capabilitiesFirefox(capabilities);
    } else if (browser.toLowerCase().equals("phantomjs")) {
        capabilities = capabilitiesPhantomJS(capabilities);
    } else if (browser.toLowerCase().equals("chrome")) {
        capabilities = capabilitiesChrome(capabilities);
    } else if (browser.toLowerCase().equals("iexplore")) {
        capabilities = capabilitiesExplorer(capabilities);
    } else if (browser.toLowerCase().equals("android")) {
        capabilities = capabilitiesAndroid(capabilities);
    } else if (browser.toLowerCase().equals("iphone")) {
        capabilities = capabilitiesiPhone(capabilities);
    } else if (browser.toLowerCase().equals("ipad")) {
        capabilities = capabilitiesiPad(capabilities);
    }
    if (!location.toLowerCase().contains("local")) {
        log.info("Running on Selenium Grid: " + location);
        driver = new RemoteWebDriver(new URL(location), capabilities);
    } else if (browser.toLowerCase().equals("firefox")) {
        driver = new FirefoxDriver(capabilities);
    } else if (browser.toLowerCase().equals("phantomjs")) {
        driver = new PhantomJSDriver(capabilities);
    } else if (browser.toLowerCase().equals("chrome")) {
        driver = new ChromeDriver(capabilities);
    } else if (browser.toLowerCase().equals("iexplore")) {
        driver = new InternetExplorerDriver(capabilities);
    } else if (browser.toLowerCase().equals("android")) {
        driver = new ChromeDriver(capabilities);
    } else if (browser.toLowerCase().equals("iphone")) {
        driver = new ChromeDriver(capabilities);
    } else if (browser.toLowerCase().equals("ipad")) {
        driver = new ChromeDriver(capabilities);
    }
    ngDriver = new NgWebDriver(driver);
    wait = new WebDriverWait(driver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(driver);
}
Also used : PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) InternetExplorerDriver(org.openqa.selenium.ie.InternetExplorerDriver) NgWebDriver(com.jprotractor.NgWebDriver) Actions(org.openqa.selenium.interactions.Actions) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) URL(java.net.URL) Before(cucumber.api.java.Before)

Aggregations

NgWebDriver (com.jprotractor.NgWebDriver)1 Before (cucumber.api.java.Before)1 URL (java.net.URL)1 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)1 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1 InternetExplorerDriver (org.openqa.selenium.ie.InternetExplorerDriver)1 Actions (org.openqa.selenium.interactions.Actions)1 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)1