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
In the same way for Chrome Browser below are the things to be considered.
Step 1-->Import files Required for Chrome :
import org.openqa.selenium.chrome.*;
Step 2--> Set the Path and initialize the Chrome Driver:
System.setProperty("webdriver.chrome.driver","S:\\chromedriver_win32\\chromedriver.exe");
Note: In Step 2 the location should point the chromedriver.exe file's storage location in your system drive
step 3--> Create an instance of Chrome browser
WebDriver driver = new ChromeDriver();
Rest will be the same as...
To run test cases in IE Browser make sure you have downloaded IE driver and you need to set the property as well.
Below code will help you
// This will set the driver
System.setProperty("webdriver.ie.driver","driver path\\IEDriverServer.exe");
// Initialise browser
WebDriver driver=new InternetExplorerDriver();
You can check IE Browser challenges with Selenium and complete code for more details
It needs to set same Security level in all zones. To do that follow the steps below:
1.Open IE
2.Go to Tools -> Internet Options -> Security
3.Set all zones (Internet, Local intranet, Trusted sites, Restricted sites) to the same protected mode, enabled or disabled should not matter.
Finally, set Zoom level to 100% by right clicking on the gear located at the top right corner and enabling the status-bar. Default zoom level is now displayed at the lower right.
Go to Tools -> Internet Options -> Security and Enable protection mode for all zones. It worked for me :)
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.*;
public class IEclass {
public static void main(String[] args) {
System.setProperty("webdriver.ie.driver","S:\\IE and Chrome ServerDriver\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.google.com");
}
}
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.
http://codebit.in/question/1/selenium-webdriver-java-code-launch-internet-explorer-brow