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