When i give WebDriver driver=new ChromeDriver();

0 votes
When i give the syntax
 WebDriver driver=new ChromeDriver();
It is showing error at chrome driver and the fix available is  change the webdriver to chrome driver . It is fine if the syntax is  ChromeDriver driver= new ChromeDriver();
Oct 23 in Selenium by Suma
• 120 points
113 views

1 answer to this question.

0 votes

If you use ChromeDriver driver = new ChromeDriver(); the ChromeDriver instance which will get created through that we will be only able to invoke and act on the methods implemented by ChromeDriver and supported by Chrome Browser only. To act with other browsers we have to specifically create individual objects as below :

  • FirefoxDriver driver = new FirefoxDriver();
  • InternetExplorerDriver driver = new InternetExplorerDriver();

WebDriver Interface

From Selenium perspective, the WebDriver Interface is similar like a agreement which the 3rd party Browser Vendors like MozillaChromeInternet ExplorerSafari, etc have to adhere and implement the same. This would in-turn help the end-users to use the exposed APIs to write a common code and implement the functionalities across all the available browsers without any change.

Through WebDriver driver = new ChromeDriver(); we are creating an instance of the WebDriver interface and casting it to ChromeDriver class. 

answered Oct 23 by Karan
• 19,570 points

Related Questions In Selenium

0 votes
1 answer

I tried to open a new website when a new tab is opened using Selenium Webdriver

Try this code: ArrayList<String> tabs = new ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,520 points
2,132 views
+2 votes
2 answers

I'm Getting error as soon as I Initialize driver = new ChromeDriver();

Hi Prajwal, this type of error occurs ...READ MORE

answered Oct 10, 2019 in Selenium by Abha
• 27,950 points
7,319 views
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,520 points
3,610 views
0 votes
2 answers

When executing my Jenkins tests with Selenium WebDriver, I do not see a GUI.

Hi eLiJha, I also faced the same issue ...READ MORE

answered Jul 15, 2019 in Selenium by nayan
• 160 points
5,849 views
+1 vote
1 answer

Can someone explain the meaning of WebDriver wd = new ChromeDriver();?

WebDriver webdriver = new ChromeDriver(); The following simply ...READ MORE

answered Dec 14, 2018 in Selenium by Aniket
125 views
0 votes
1 answer

How can I download Microsoft WebDriver/Edge Driver to use with Selenium?

Hi William, to download Microsoft Webdriver or ...READ MORE

answered Jul 15, 2019 in Selenium by Abha
• 27,950 points
12,590 views
0 votes
1 answer

Can anyone suggest how can I restore cookies in new browser window using Webdriver?

Hey Akshay, following code snippet would help ...READ MORE

answered Aug 14, 2019 in Selenium by Abha
• 27,950 points
258 views
0 votes
1 answer

String insId=RecInspage.getInsIdByTransportName(driver, fileName).getText(); I want to give explicit wait for this how to write code?

Check out this link https://www.edureka.co/blog/waits-in-selenium/ This will give you ...READ MORE

answered Apr 26 in Selenium by Sirajul
• 58,210 points
60 views
+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13 in Selenium by Karan
• 19,570 points
2,871 views