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, 2020 in Selenium by Suma
• 120 points
6,888 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. 

Want to learn more about Webdriver? Enroll for the Selenium Training today.

answered Oct 23, 2020 by Karan
• 19,610 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,500 points
4,439 views
+1 vote
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 11, 2019 in Selenium by Abha
• 28,140 points

edited Sep 6, 2023 by Khan Sarfaraz 35,326 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 13, 2018 in Selenium by nsv999
• 5,500 points
6,190 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
13,375 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 15, 2018 in Selenium by Aniket
965 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
• 28,140 points
40,876 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
• 28,140 points
1,053 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 27, 2020 in Selenium by Sirajul
• 59,230 points
646 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, 2020 in Selenium by Karan
• 19,610 points
8,340 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP