adspace


What is the purpose of creating a reference variable- 'driver' of type webdriver instead of directly creating a firefoxdriver object or any other driver's reference in the statement webdriver driver = new firefoxdriver();?

Answer Posted / Anupam Kumar Singh Tomer

Creating a reference variable of type WebDriver, such as 'driver', provides flexibility to switch between different browsers (like Chrome, Firefox, Safari, etc.) during testing by simply changing the driver class. This abstraction allows for more efficient code maintenance and reusability.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you fetch an attribute from an element? How to retrieve typed text from a textbox?

1197


What’s selenese?

920


Have you created any framework?

1039


what will be the first salary and what will be the hike in the salary?

929


Do you know how to locate a link using its text in selenium?

986