Selenium 2 WebDriver Advanced
  • Preface
  • 1. API Testing Using Selenium WebDriver
    • 1.1 Code Snippet for API testing
    • 1.2 SoapUI
      • 1.2.1 Add selenium jars to soapUI
      • 1.2.2 Run selenium tests
      • 1.2.3 Data Driven Testing using SoapUI
  • 2. Advanced Profiles for Browsers
    • 2.1 Profile for Firefox Browser
    • 2.2 Profile for Chrome Browser
    • 2.3 Profile for IE Browser
    • 2.4 Profile for Safari Browser
    • 2.5 Profile for Opera Browser
  • 3. TestNG
    • 3.1 Sample TestNG class
    • 3.2 Parallel execution
    • 3.3 Execution of tests from batch file
  • 4. ExtentReports
    • 4.1 Basics
    • 4.2 Sample Extent Reports
  • 5. Advanced tricks
    • 5.1 Keystroke handling
    • 5.2 Screenshot capture
    • 5.3 Get HTML Source of WebElement
Powered by GitBook
On this page

Was this helpful?

  1. 2. Advanced Profiles for Browsers

2.3 Profile for IE Browser

Some of the Profile settings for Internet Explorer Driver are mentioned in the below snippet.

package code;

import java.io.File;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ProxiesCertificates {
    WebDriver driver;
    String baseUrl;

    @BeforeTest
    public void setup() {

        // Below code for the Internet Explorer capability 
       DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
        // Set ACCEPT_SSL_CERTS variable to true
        ieCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        //To set the proxy to auto detect network settings
        ieCapabilities.setCapability("network.proxy.type", ProxyType.AUTODETECT.ordinal());
        //Added to avoid the Protected Mode settings for all zones
        ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); 
        ieCapabilities.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "about:blank");
        ieCapabilities.setCapability(InternetExplorerDriver.SILENT, true);
        ieCapabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
        ieCapabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING,true);
        System.setProperty("webdriver.ie.driver","C:\\SaiKiran\\Drivers\\IEDriverServer.exe");
        //Add Pop-up allowed in IE manually
        driver = new InternetExplorerDriver(ieCapabilities);
        driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
        driver.manage().deleteAllCookies();
        driver.manage().window().maximize();
    }

    @Test
    public void testMethod() {
        baseUrl = "http://docs.seleniumhq.org/";
        driver.get(baseUrl);
    }

    @AfterTest
    public void teardown() {
        driver.quit();
    }

}
Previous2.2 Profile for Chrome BrowserNext2.4 Profile for Safari Browser

Last updated 5 years ago

Was this helpful?