Register to Better Coder! It's free.
Enjoy the premium features and succeed at every job interview.
How do I launch the browser using Selenium WebDriver?
Experience Level: Junior
Tags: Quality Assurance (QA)Selenium
Answer
Answer
- Create a new WebDriver instance for a specific browser.
- Call Navigate() to retrieve a navigation object.
- Then call GoToUrl(...) method and pass the URL that you want the browser to navigate to as a parameter.
Long story short, do something like this:
using (var driver = new FirefoxDriver())
{
var url = "https://www.bettercoder.com";
driver.Navigate().GoToUrl(url);
}
If you are wondering what the "using" keyword is good for, it's a C# way to release the driver from memory once it's not needed anymore.
Related Quality Assurance (QA) job interview questions
What are the different types of waits available in WebDriver?
Quality Assurance (QA)Selenium JuniorWhat are the different types of Drivers available in WebDriver?
Quality Assurance (QA)Selenium JuniorWhich is the latest Selenium tool?
Quality Assurance (QA)Selenium JuniorWhat is the difference between / and // in XPath?
Quality Assurance (QA)XML JuniorWhat is an XPath?
Quality Assurance (QA)SeleniumXML Junior