Example usage for org.openqa.selenium.ie InternetExplorerDriver InternetExplorerDriver

List of usage examples for org.openqa.selenium.ie InternetExplorerDriver InternetExplorerDriver

Introduction

In this page you can find the example usage for org.openqa.selenium.ie InternetExplorerDriver InternetExplorerDriver.

Prototype

public InternetExplorerDriver() 

Source Link

Usage

From source file:edu.umd.cs.guitar.crawljax.browser.WebDriverBrowserWrapperBuilder.java

License:Open Source License

/**
 * Build a new WebDriver based EmbeddedBrowser.
 *
 * @see EmbeddedBrowserBuilder#buildEmbeddedBrowser(CrawljaxConfigurationReader)
 * @param configuration the configuration object to read the config values from
 * @return the new build WebDriver based embeddedBrowser
 *///from www .j  a v  a  2s  . c  o  m
@Override
public EmbeddedBrowser buildEmbeddedBrowser(CrawljaxConfigurationReader configuration) {
    // Retrieve the config values used
    List<String> filterAttributes = configuration.getFilterAttributeNames();
    int crawlWaitReload = configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl();
    int crawlWaitEvent = configuration.getCrawlSpecificationReader().getWaitAfterEvent();

    EmbeddedBrowser internalBrowser;
    // Determine the requested browser type
    switch (configuration.getBrowser()) {
    case firefox:
        if (configuration.getProxyConfiguration() != null) {
            FirefoxProfile profile = new FirefoxProfile();

            profile.setPreference("network.proxy.http", configuration.getProxyConfiguration().getHostname());
            profile.setPreference("network.proxy.http_port", configuration.getProxyConfiguration().getPort());
            profile.setPreference("network.proxy.type",
                    configuration.getProxyConfiguration().getType().toInt());
            profile.setPreference("network.proxy.no_proxies_on", "");
            internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new FirefoxDriver(profile),
                    filterAttributes, crawlWaitReload, crawlWaitEvent);
            break;
        } else {
            internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new FirefoxDriver(),
                    configuration.getFilterAttributeNames(),
                    configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                    configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
            break;
        }
    case ie:

        internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new InternetExplorerDriver(),
                configuration.getFilterAttributeNames(),
                configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
        break;
    case chrome:
        internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new ChromeDriver(),
                configuration.getFilterAttributeNames(),
                configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
        break;
    case remote:
        internalBrowser = WebDriverBackedEmbeddedBrowser.withRemoteDriver(configuration.getRemoteHubUrl(),
                configuration.getFilterAttributeNames(),
                configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
        break;
    case htmlunit:
        internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new HtmlUnitDriver(true),
                configuration.getFilterAttributeNames(),
                configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
        break;
    default:
        internalBrowser = WebDriverBackedEmbeddedBrowser.withDriver(new FirefoxDriver(),
                configuration.getFilterAttributeNames(),
                configuration.getCrawlSpecificationReader().getWaitAfterEvent(),
                configuration.getCrawlSpecificationReader().getWaitAfterReloadUrl());
        break;
    }

    WebDriverBackedEmbeddedBrowserWraper browserWrapper = new WebDriverBackedEmbeddedBrowserWraper(
            internalBrowser);
    for (CJBrowserMonitor monitor : browserMonitorList) {
        browserWrapper.addMonitor(monitor);
    }
    return browserWrapper;
}

From source file:fr.lip6.segmentations.BrowserRep.java

License:Open Source License

public void setLocalDriver() {
    switch (this.desc) {
    case "firefox":
        this.driver = new FirefoxDriver();
        break;/*from   ww  w  .  jav a  2s . com*/
    case "iexplorer":
        this.driver = new InternetExplorerDriver();
        break;
    case "chrome":
        this.driver = new ChromeDriver();
        break;
    case "opera":
        this.driver = new OperaDriver();
        break;
    case "htmlunit":
        this.driver = new HtmlUnitDriver();
        break;
    }
    setJSDriver();
    this.driver.manage().timeouts().pageLoadTimeout(MAX_WAIT_S, TimeUnit.SECONDS);
    this.driver.manage().timeouts().implicitlyWait(MAX_WAIT_S, TimeUnit.SECONDS);
    this.driver.manage().window().setSize(new org.openqa.selenium.Dimension(1024, 768));
}

From source file:gov.nih.nci.firebird.commons.selenium2.test.WebDriverModule.java

License:Open Source License

@Provides
@Singleton//w w w .jav a 2  s.  c o m
@Named("selenium.iexplore.driver")
public WebDriver provideInternetExplorerDriver() {
    final WebDriver driver = new InternetExplorerDriver();
    closeDriverOnShutdown(driver);
    return driver;
}

From source file:IE11.AddProductIE11.java

@BeforeClass
public static void setUpClass() throws Exception {

    System.setProperty("webdriver.ie.driver", "D:\\Documentatie\\Selenium\\IE11\\IEDriverServer.exe");
    driver = new InternetExplorerDriver();

    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.manage().window().maximize();

    driver.get(Constants.URLProdus);//from  w w  w  . ja va 2  s . co  m
}

From source file:influent.selenium.tests.BrowserParameterizedTest.java

License:MIT License

private void initializeLocal(BROWSER browser) {
    switch (browser) {
    case FIREFOX:
        this.driver = new FirefoxDriver();
        break;// w w  w . j  av  a  2  s.c o  m
    case CHROME:
        // need to set a property for the chrome webdriver
        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\chromedriver.exe");
        this.driver = new ChromeDriver();
        break;
    case IE:
        // need to set a property for the internet explorer webdriver
        System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + "\\IEDriverServer.exe");
        this.driver = new InternetExplorerDriver();
        break;
    default:
        this.driver = null;
        break;
    }
}

From source file:io.fabric8.selenium.SeleniumTests.java

License:Apache License

protected static WebDriver doCreateWebDriver() {
    String driverName = Systems.getEnvVarOrSystemProperty(FABRIC8_WEBDRIVER_NAME);
    if (driverName != null) {
        driverName = driverName.toLowerCase();
        if (driverName.equals("chrome")) {
            return new ChromeDriver();
        } else if (driverName.equals("edge")) {
            return new EdgeDriver();
        } else if (driverName.equals("firefox")) {
            return new FirefoxDriver();
        } else if (driverName.equals("htmlunit")) {
            return new HtmlUnitDriver();
        } else if (driverName.equals("internetexplorer") || driverName.equals("ie")) {
            return new InternetExplorerDriver();
        } else if (driverName.equals("opera")) {
            return new OperaDriver();
        } else if (driverName.equals("phantomjs")) {
            return new PhantomJSDriver();
            /*/*from w w  w .  j  av a  2 s.com*/
                        } else if (driverName.equals("remote")) {
                            return new RemoteWebDriver();
            */
        } else if (driverName.equals("safari")) {
            return new SafariDriver();
        } else if (driverName.equals("htmlunit")) {
            return new HtmlUnitDriver();
        }
    }
    return new ChromeDriver();
}

From source file:io.github.blindio.prospero.core.browserdrivers.BrowserDriverFactory.java

License:Apache License

/**
 * builds a WebDriver object for the correct Browser based upon the property
 * 'browser'/* ww  w.  j  a v a2 s.c o  m*/
 * 
 * @param siteURL
 * @return
 */
private static WebDriver buildWebDriver() {
    WebDriver wd = null;
    Browser browser = getBrowserFromConfig();

    // TODO: this needs a lot more work with Capabilities
    if (browser == Browser.FIREFOX) {
        wd = new FirefoxDriver();
    }

    else if (browser == Browser.HTMLUNIT) {
        wd = new HtmlUnitDriver(true);
    }

    else if (browser == Browser.INTERNET_EXPLORER) {
        System.setProperty(IE_WEBDRIVER_SYS_OPTION, Config.getString(PropertiesConstants.DRIVER_LOCATION));

        wd = new InternetExplorerDriver();
    }

    else if (browser == Browser.CHROME) {
        System.setProperty(CHROME_WEBDRIVER_SYS_OPTION, Config.getString(PropertiesConstants.DRIVER_LOCATION));

        wd = new ChromeDriver();
    }

    else if (browser == Browser.ANDROID) {
        if (Config.containsKey(PropertiesConstants.REMOTE_WEBDRIVER_URL)) {
            try {
                wd = new RemoteWebDriver(new URL(Config.getString(PropertiesConstants.REMOTE_WEBDRIVER_URL)),
                        DesiredCapabilities.android());
            } catch (MalformedURLException mue) {
                throw new ProsperoParseException(mue);
            }
        } else {
            wd = new AndroidDriver();
        }
    }

    else if (browser == Browser.IPHONE || browser == Browser.IPAD) {
        DesiredCapabilities dc;
        if (browser == Browser.IPHONE) {
            dc = DesiredCapabilities.iphone();
        } else {
            dc = DesiredCapabilities.ipad();
        }

        try {
            wd = new RemoteWebDriver(
                    new URL(Config.getString(PropertiesConstants.REMOTE_WEBDRIVER_URL, DEFAULT_IWEBDRIVER_URL)),
                    dc);
        } catch (MalformedURLException mue) {
            throw new ProsperoParseException(mue);
        }
    }

    else if (browser == Browser.GHOSTDRIVER) {
        // TODO
        // Find open socket
        // ServerSocket sock = new ServerSocket(0);
        // int openPort = sock.getLocalPort();
        // sock.close();

        // String phantomjsServerStartCmd = "phantomjs";
        // Runtime.getRuntime().exec();

        String phantomJSExecutable = PhantomJSInstaller.getPhantomJS();
        DesiredCapabilities dCaps = new DesiredCapabilities();
        dCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJSExecutable);
        dCaps.setJavascriptEnabled(true);
        dCaps.setCapability("takesScreenshot", false);
        wd = new PhantomJSDriver(dCaps);
    }

    if (browser.isWindowed() && Config.containsKey(PropertiesConstants.BROWSER_WIDTH)
            && Config.containsKey(PropertiesConstants.BROWSER_HEIGHT)) {
        wd.manage().window().setSize(getBrowserDimensions());
    }

    return wd;
}

From source file:io.github.bonigarcia.wdm.test.IExplorerTest.java

License:Open Source License

@Before
public void setupTest() {
    if (validOS) {
        driver = new InternetExplorerDriver();
    }
}

From source file:io.github.bonigarcia.wdm.test.InternetExplorerTest.java

License:Apache License

@Before
public void setupTest() {
    driver = new InternetExplorerDriver();
}

From source file:io.kahu.hawaii.cucumber.glue.html.HtmlSteps.java

License:Apache License

@Before("@web")
public void beforeScenario() throws Exception {
    WebDriver driver;//from w  w  w . ja  v a 2  s. c o m
    if (StringUtils.containsIgnoreCase(browser, "chrome")) {
        if (remote) {
            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
            driver = createRemoteWebDriverForCapabilities(capabilities);
        } else {
            driver = new ChromeDriver();
        }
    } else if (StringUtils.containsIgnoreCase(browser, "opera")) {
        if (remote) {
            DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
            driver = createRemoteWebDriverForCapabilities(capabilities);
        } else {
            driver = new OperaDriver();
        }
    } else if (StringUtils.containsIgnoreCase(browser, "firefox")) {
        if (remote) {
            DesiredCapabilities capabilities = DesiredCapabilities.firefox();
            driver = createRemoteWebDriverForCapabilities(capabilities);
        } else {
            driver = new FirefoxDriver();
        }
    } else if (StringUtils.containsIgnoreCase(browser, "htmlunit")) {
        driver = new HtmlUnitDriver(BrowserVersion.CHROME);
    } else if (StringUtils.containsIgnoreCase(browser, "iexplore")) {
        if (remote) {
            DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
            driver = createRemoteWebDriverForCapabilities(capabilities);
        } else {
            driver = new InternetExplorerDriver();
        }

    } else if (StringUtils.containsIgnoreCase(browser, "phantom")) {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                getOsSpecificPhantomDriverPath());
        Proxy proxy = getHttpProxy();
        if (proxy != null) {
            capabilities.setCapability(CapabilityType.PROXY, getHttpProxy());
        }
        driver = new PhantomJSDriver(capabilities);
    } else if (StringUtils.containsIgnoreCase(browser, "safari")) {
        if (remote) {
            DesiredCapabilities capabilities = DesiredCapabilities.safari();
            driver = createRemoteWebDriverForCapabilities(capabilities);
        } else {
            driver = new SafariDriver();
        }
    } else {
        throw new IllegalStateException("Unsupported browser specified");
    }
    webDriver = new EventFiringWebDriver(driver);
    webDriver.manage().deleteAllCookies();
    turnOnImplicitWaits();
}