Friday, January 8, 2016

Selenium Internet Explorer Driver usage

Available Constructors for InternetExplorerDriver




  • Use of internet explorer constructor "InternetExplorerDriver(capabilities)"



   // using Internet Explorer local through Internet Explorer Driver  
      public static void ieLocalDriver(WebDriver driver) {  
           System.setProperty("webdriver.ie.driver",  
                     "C:\\Java_Source_Code\\IEDriverServer_Win32_2.48.0\\IEDriverServer.exe");  
           DesiredCapabilities capabilities = new DesiredCapabilities();  
           // setting IE specific capability  
           // this is to override Protected mode settings for zones  
           capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);  
           // this is for setting logging  
           capabilities.setCapability(InternetExplorerDriver.LOG_FILE, "C:\\Test\\ie_log\\logs.log");  
           // this is for setting logging level  
           capabilities.setCapability("logLevel", "INFO");  
           driver = new InternetExplorerDriver(capabilities);  
  
      }  


  • Use of  set capability

capability can be either set through InternetExplorerDriver class static fields OR can be set through static final fields from CapabilityType Interface.


  • Using InternetExplorerDriver constructor  "InternetExplorerDriver(service, capabilities)"


      public static void ieLocalDriver02(WebDriver driver) {  
           System.setProperty("webdriver.ie.driver",  
                     "C:\\Java_Source_Code\\IEDriverServer_Win32_2.48.0\\IEDriverServer.exe");  
           // this is to override Protected mode settings for zones  
           DesiredCapabilities capabilities = new DesiredCapabilities();  
           capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);  
           InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder();  
           InternetExplorerDriverService service = builder.withLogFile(new File("C:\\Test\\ie_log\\ie.log"))  
                     .withLogLevel(InternetExplorerDriverLogLevel.INFO).build();  
           // I am using the capability and service both  
           driver = new InternetExplorerDriver(service, capabilities);  
      }  


Internet Explorer specific capability 
https://code.google.com/p/selenium/wiki/DesiredCapabilities

This is how the capability constructor are used



For setting up the capability of a browser either you use STATIC FINAL VALUES of 
InternetExplorerDriver



OR 
pass it as a String parameter to capabilities.setCapability(String, String value), etc

Other Internet Explorer Capabilities


   

No comments:

Post a Comment