Selenium Interview Questions and Answers
Question - 91 : - Mention in what ways you can customize TestNG report?
Answer - 91 : -
You can customize TestNG report in two ways,
- Using ITestListener Interface
- Using IReporter Interface
Question - 92 : - To generate pdf reports mention what Java API is required?
Answer - 92 : -
To generate pdf reports, you need Java API IText.
Question - 93 : - Mention what is Listeners in Selenium WebDriver?
Answer - 93 : -
In Selenium WebDriver, Listeners “listen” to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners.
Question - 94 : - Mention what are the types of Listeners in TestNG?
Answer - 94 : -
The types of Listeners in TestNG are,
- IAnnotationTransformer
- IAnnotationTransformer2
- IConfigurable
- IConfigurationListener
- IExecutionListener
- IHookable
- IInvokedMethodListener
- IInvokedMethodListener2
- IMethodInterceptor
- IReporter
- ISuiteListener
- ITestListener
Question - 95 : - Mention what is desired capability? How is it useful in terms of Selenium?
Answer - 95 : -
The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time.
For Selenium,
- It can be used to configure the driver instance of Selenium WebDriver.
- When you want to run the test cases on a different browser with different operating systems and versions.
Question - 96 : - For Database Testing in Selenium Webdriver what API is required?
Answer - 96 : -
For Database Testing in Selenium Webdriver, you need JDBC (Java Database Connectivity) API. It allows you to execute SQL statements.
Question - 97 : - Mention when to use AutoIT?
Answer - 97 : -
Selenium is designed to automate web-based applications on different browsers. But to handle window GUI and non-HTML popups in the application you need AutoIT. know more about How to use AutoIT with Selenium
Question - 98 : - Mention why do you need Session Handling while working with Selenium?
Answer - 98 : -
While working with Selenium, you need Session Handling. This is because, during test execution, the Selenium WebDriver has to interact with the browser all the time to execute given commands. At the time of execution, it is also possible that, before current execution completes, someone else starts execution of another script, in the same machine and in the same type of browser. So to avoid such situation you need Session Handling.
Question - 99 : - Mention what are the advantages of Using Git Hub For Selenium?
Answer - 99 : -
The advantages of Using Git Hub for Selenium are
- Multiple people when they work on the same project they can update project details and inform other team members simultaneously.
- Jenkins can help you to build the project from the remote repository regularly. This helps you to keep track of failed builds.
Question - 100 : - Can selenium be used to launch web browsers?
Answer - 100 : -
Yes, Selenium provides good support to launch web browsers like Google Chrome, Mozilla Firefox, Internet Explorer, etc.
The following commands can be used to launch web browsers using Selenium:
- WebDriver driver = new FirefoxDriver();
- WebDriver driver = new ChromeDriver();
- WebDriver driver = new InternetExplorerDriver();