Selenium Interview Questions and Answers
Ques 26. What is the wait? How many types of waits in selenium?
Selenium Webdriver introduces the concept of waits for the AJAX-based application. There are two types of waits:
- Implicit Wait
- Explicit Wait
Ques 27. What is the main disadvantage of implicit wait?
The main disadvantage of implicit wait is that it slows down test performance.
Another disadvantage of implicit wait is:
Suppose, you set the waiting limit to be 10 seconds, and the elements appear in the DOM in 11 seconds, your tests will be failed because you told it to wait a maximum of 10 seconds.
Ques 28. What is Selenium Grid?
Selenium Grid facilitates you to distribute your tests on multiple machines and all of them at the same time. So, you can execute tests on Internet Explorer on Windows and Safari on Mac machine using the same text script. It reduces the time of test execution and provides quick feedback.
Ques 29. How can we launch different browsers in Selenium WebDriver?
We have to create an instance of a driver of that particular browser.
WebDriver driver =newFirefoxDriver();
Here, "WebDriver" is an interface, and we are creating a reference variable "driver" of type WebDriver, instantiated using "FireFoxDriver" class.
Ques 30. Write a code snippet to launch Firefox browser in WebDriver.
public class FirefoxBrowserLaunchDemo {
public static void main(String[] args) {
//Creating a driver object referencing WebDriver interface
WebDriver driver;
//Setting webdriver.gecko.driver property
System.setProperty("webdriver.gecko.driver", pathToGeckoDriver + "\\geckodriver.exe");
//Instantiating driver object and launching browser
driver = newFirefoxDriver();
//Using get() method to open a webpage
driver.get("http://javatpoint.com");
//Closing the browser
driver.quit();
}
}
Most helpful rated by users: