-3

Can anyone please let me know the technical difference in implementation of different browser like Firefox, Chrome and IE webdriver in selenium webdriver??

Ajinkya
  • 22,324
  • 33
  • 110
  • 161
marck
  • 681
  • 1
  • 6
  • 12
  • They are different browsers?????? – Arran Jul 14 '14 at 08:31
  • Google it, you can get more info. if you're concerned about any thing particular, detail it. – Vignesh Paramasivam Jul 14 '14 at 13:21
  • I feel like people doesn't understand the question maybe, if webdriver is a standard why do we need to instantiate different classes for each one of them. I am guessing they don't follow the standard yet but no idea about exact differences. – Agustin Cautin Oct 12 '18 at 09:44

3 Answers3

0

Each driver is used to automate the application in that particular browser.

For example, if you use FirefoxDriver, your automation script will run in Firefox browser.

Technically their implementation is different and based on WebDriver interface.

Purus
  • 5,701
  • 9
  • 50
  • 89
0

ChromeDriver, InternetExplorerDriver and FirefoxDriver are implementation of WebDriver interface. Each provides implementation corresponding to the appropriate browser.
You dont need to change the code when you change the browser. You can write the code using instance of WebDriver and just change implementing object depending on the browser. Like if you are using Firefox

WebDriver driver = new FirefoxDriver();
driver.get("SOME_RANDOM_URL");
driver.find("SOME_RANDOM_ELEMENT");

if you want to change browser to chrome

WebDriver driver = new ChromeDriver();
// rest of the code will remain same

This is called Programming to interfaces.

Community
  • 1
  • 1
Ajinkya
  • 22,324
  • 33
  • 110
  • 161
  • This sentence would be incorrect "You dont need to change the code when you change the browser." Some of the WebDrivers do not implement all command so need to use different flow. Question edited to mention this point. – Baha Jun 22 '17 at 11:26
0

The code remains the same except for the driver instances and paths you will be specifying; As you would have already known, for firefox, you don't need to download any drivers explicitly. You just create the driver instance as below -

a) Firefox -

driver = new FirefoxDriver();

b) IE - For IE, you need to download IE driver and then place it in your drive. You then include the driver path in your code as follows (replace with your driver path in code below) -

System.setProperty("webdriver.ie.driver","C:\\Program Files (x86)\\Internet Explorer\\IEDriverServer.exe");
driver = new InternetExplorerDriver();

c) Chrome - For Chrome again, you need to download chrome driver and then place it in your drive. You then include the driver path in your code as follows (replace with your driver path in code below)-

System.setProperty("webdriver.chrome.driver","C:\\Program Files (x86)\\Internet Explorer\\chromedriver.exe");
driver = new ChromeDriver();
user3657330
  • 158
  • 4
  • 11