91. How to handle hidden elements in Selenium Webdriver?
Answer: We can handle hidden elements by using JavaScript Executer.
Ex: (JavascriptExecuter(driver)).executeScript(“document.getElementsByClassName(ElementLocator).click();”);


92. How to read a JavaScript variable in selenium webDriver?
Answer: By using JavaScriptExecuter.
Ex:
JavascriptExecuter JS = (JavascriptExecuter)driver;
//to get the site title
String title = (String) JS.executeScript(“return document.title”); Syso(title);


93. Is it possible to Automate Captcha using Selenium?
Answer: No.


94. How to read data from an Excel File ?
Answer: Apache POI API


95. List some scenarios which we cannot automate using Selenium ?
Answer:
1. Bitmap comparison is not possible .
2. Automation Captcha
3. We cannot read bar code.
4. Windows OS based pop ups.
5. Some third party Calendars.
6. Word/PDF comparison.
7. Image comparison.


96. What is Object Repository in Selenium WebDriver?
Answer: Object Repository is used to store element locator values in a centralized location instead of hard coding them within the scripts. We do create a “.properties” file to store all the element locators and these property files act as an object repository in Selenium Webdriver.


97. How can you use the Recovery Scenario in Selenium Webdriver?
Answer: By using “Try Catch block”. within selenium webdriver java tests.


98. How to upload a file in Selenium Webdriver?
Answer: There are two ways which area a majorly used to upload a file in Selenium Webdriver such as using SendKeys Method and using AutoIt Script.
Ex: IF browser <button type=”file”> then we can use SendKeys(c:\\tests\\bjs.jpg);


99. How to download a file in Selenium Webdriver?
Answer: By using AutoIt. Or by profiling default download location.


100. How to run TestNG using Command Prompt? 
Answer: java org.testng.TestNG c:\users\Desktop\workspace\testing\test.xml


One response to “Selenium Interview Questions for Freshers and Experienced”

Leave a Reply