Supported classes to be imported:
Code to start IE browser:
System. setproperty ("WebDriver. ie. Driver", iedriverserver.exe storage path );
WebDriver driver = new internetexplorerdriver ();
Driver. Get ("http://www.baidu.com ");
Driver. Quit (); // close the browser
If the code above prompts an error similar to the following:
If the preceding error message is displayed, it indicates that the environment is faulty. In this case, check whether the required jar package has been added to the project. If not, copy all the jar packages (including the selenium-jar-x.x.x and libs Directories) in the WebDriver directory, right-click and paste on the project, and then check whether these packages have been imported into the project, if no, right-click the project: properties-> JAVA build path-> library, and then respond to 'add jar' in the interface ', add all the copied jar packages to the project.
If you still cannot start IE after completing all the preceding operations, and an exception similar to the following error is reported in thread "main" Org. openqa. selenium. webdriverexception: Unexpected error launching Internet Explorer. protected Mode settings are not the same for all zones. enable protected mode must be set to the same value (enabled or disabled) for all zones. (warning: the server did not provide any stacktrace Information)
System Info: OS. name: 'windows 7', OS. arch: 'amd64', OS. version: '6. 1', Java. version: '1. 7.0 _ 25 ′
The consideration is that the IE security level is too high. The solution is to set the security level to the lowest in the Internet option and deselect the 'Enable protection mode' check;
After completing the above operations, ie will be able to start smoothly.