To launch Internet explorer
To run selenium webdriver in IE browser, we need InternetExplorerDriver which is a standalone server which implements WebDriver's wire protocol.
First of all, download latest version of IEDriver server for webdriver. You can download latest version server from Download InternetExplorerEDriver
Note: Choose the IEdriver server based on your working environment as there are two different zip files for both 32 and 64 bit IE .
Save the downloaded file to your local machine.
In your code you need to set the system property for IE driver as
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer.exe");
Script :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LaunchIE { | |
public static void main(String[] args) throws InterruptedException { | |
// TODO Auto-generated method stub | |
// set the path of IE driver | |
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer.exe"); | |
WebDriver myTestDriver=new InternetExplorerDriver(); | |
myTestDriver.get("http://www.google.com"); | |
Thread.sleep(2000); | |
myTestDriver.manage().window().maximize(); | |
Thread.sleep(7000); | |
myTestDriver.close(); | |
} | |
} |
Output :
Should launch IE browser and should navigate to google site.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.