How can I start InternetExplorerDriver using Selenium WebDriver

前端 未结 16 2446
半阙折子戏
半阙折子戏 2020-12-30 17:23

I downloaded the driver and I gave the exact path in my code but when I ran the code it shows me error

my code with java is as below:

System.out.prin         


        
相关标签:
16条回答
  • 2020-12-30 17:45

    package Browser;

    import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver;

    public class Hello {

    public static void main(String[] args) {
    
    
        // setting IEdriver property
        System.setProperty("webdriver.ie.driver",
                "paste the path of the IEDriverserver.exe");
    
        WebDriver driver = new InternetExplorerDriver();
    
        // launching the google home screen
        driver.get("https://www.google.com/?gws_rd=ssl");
    
    }
    

    } //Hope this will work

    0 讨论(0)
  • 2020-12-30 17:47

    Below steps are worked for me, Hope this will work for you as well,

    1. Open internet explorer.
    2. Navigate to Tools->Option
    3. Navigate to Security Tab
    4. Click on "Reset All Zones to Default level" button
    5. Now for all option like Internet,Intranet,Trusted Sites and Restricted Site enable "Enable Protected" mode check-box.
    6. Set IE zoom level to 100%
    7. then write below code in a java file and run

      System.setProperty("webdriver.ie.driver","path of your IE driver exe\IEDriverServer.exe");
      InternetExplorerDriver driver=new InternetExplorerDriver();
      driver.manage().window().maximize();
      Thread.Sleep(10100);
      driver.get("http://www.Google.com");
      Thread.Sleep(10000);
      
    0 讨论(0)
  • 2020-12-30 17:49
    1. You must set Protected Mode settings for each zone to be the same value.
    2. Enhanced Protected Mode for all zones must be same. (I prefer it to be disabled as this is the requirement for IE 10 and higher.)

    Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.

    How to do above steps???

    Have look at this video: http://screencast.com/t/5nlxsrje4I . I have showed the steps.

    Source: https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration

    Hope this helps. Thank you :)

    0 讨论(0)
  • 2020-12-30 17:50

    I've been firefighting with this issue for the past one month. And finally I found a fruitful solution. Here are the exact steps which we followed to get it worked. I have already done Required Configuration as mentioned in this link: https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration

    1. Make the internet explorer protected mode settings enable/disable for all the zones. (In my case I enabled across all the zones, doesn't matter about the levels). If your organisation not allow these settings, the other solution is to create a group at active directory level and enforce our expected internet explorer settings for that group. Add your user name to that group.
    2. Install IE Webdriver tool for windows from the below link. This is from Microsoft. No need to restart your machine after installation https://www.microsoft.com/en-au/download/details.aspx?id=44069
    3. Use these Desired Capabilities for your internet explorer driver

      DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
      capabilities.setCapability("requireWindowFocus", true);  
      capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, false);
      capabilities.setCapability("ie.ensureCleanSession", true);
      

      capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true); webDriver = new InternetExplorerDriver(capabilities);

    4. Use appropriate selenium version 2.53.1. I got it worked for the selenium version as mentioned in pom

      <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>2.53.1</version>
      </dependency>
      
    5. Download the IEDriverServer_x64_2.53.1.zip from the below link. Make sure its 2.53.1 http://selenium-release.storage.googleapis.com/index.html?path=2.53/

    6. Now go to registry settings (regedit.exe) for the current user (Don't open regedit as an Administrator) and add TabProcGrowth for the below path in regedit

    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

    Right click on Main and add new DWORD (32 bit) and make it as 0. Remember I tried 64 bit with QWORD it didn't worked for me.

    The key in this process is Step 2 which is Install IE Webdriver tool for windows

    I didn't tried this method for Selenium latest version 3.0 but will give a try.

    0 讨论(0)
  • 2020-12-30 17:50

    1---Enable protected mode for all zones You need to enable protected mode for all zones from Internet Options -> Security tab. To enable protected mode for all zones

    Open Internet Explorer browser.
    Go to menu Tools -> Internet Options.
    Click on Security tab.
    Select Internet from "Select a zone to view or change security settings" and Select(check) check box "Enable Protected Mode" from In the "Security level for this zone" block .
    Apply same thing for all other 3 zones -> Local Internet, Trusted Sites and Restricted Sites
    

    This setting will resolve error related to "Protected Mode settings are not the same for all zones.

    2-- Set IE browser's zoom level 100%

    Open Internet Explorer browser.
    Go to menu View -> Zoom -> Select 100%
    
    0 讨论(0)
  • 2020-12-30 17:51

    Below Code snippet will surely work:

        InternetExplorerOptions ops = new InternetExplorerOptions();
        // ops.ignoreZoomSettings(); -- Not necessarily in case 100% zoom.
        ops.introduceFlakinessByIgnoringSecurityDomains(); -- Necessary to skip protected 
         mode setup
    
        System.setProperty("webdriver.ie.driver",
                <path>\\IEDriverServer.exe");
        WebDriver dr = new InternetExplorerDriver(ops);
    
    0 讨论(0)
提交回复
热议问题