Back To Basics - How does WebDriver driver = new FirefoxDriver(); work?

Have you ever thought how this line works?

WebDriver driver = new FirefoxDriver();

More specifically, why are 2 types needed for creating the driver object?

And why is it possible to create a WebDriver variable but instantiate it with a FirefoxDriver object?

You can find the answer here.

Share this

3 Responses to "Back To Basics - How does WebDriver driver = new FirefoxDriver(); work?"

  1. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks..!

    Digital Marketing Services in Chennai

    Digital Marketing Company in Chennai

  2. What a great explanation... Need more such explanations on basics.. The main line that summaries is "You can create an object of an interface but can only instantiate it with the classes that implement the interface"

  3. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic
    Cara Menurunkan Leukosit Tinggi