In this article we are discussing the most popularly asked selenium interview questions and answers.
Q 1. What is Selenium?
- Selenium is a portable java script framework that runs in your web browser.
- Selenium is used for testing web applications.
- Works anywhere java script is supported.
- The test can be written as HTML tables or coded in number of popular programming languages like java, python, ruby etc.
- Selenium is available on windows and linux.
Q 2. Where we used oop’s concept in selenium?
- In selenium webdriver, In which interfaces and some abstract methods we have in it so there we use oop’s concept in selenium.
Q 3. How will use the class in java?
- By creating an object of that class we can able to use the class in java.
Q 4. Which Browsers support in selenium?
- Firefox
- Internet Explorer (IE)
- Safari
- Opera
- Chrome
- Microsoft Edge
Q 5. If we want output at console then what will do?
- If we want output at console then will pass the printing statement for getting output at console.
Q 6. Which will be the another way to fetch url instead of get() method?
- For getting the url instead of get() method we have navigate().to(“url”) method to fetch the url.
Q 7. What is a difference between quite() and Close() methods?
- The quite() and close() methods are used to close browser windows.
- 1. close() is used to close single window.
- 2. quite() is used to close all windows associated with the browser.
Q 8. What is a difference between get() and navigate().to() method?
- get() is used to get particular url and we have wait till page load.
- navigate().to() is used to navigate the particular url and does not wait for page load.
Q 9. Can we minimize the window?
- No we cannot able to minimize the window by selenium code.
Q. 10 When you run the script which massage will shows on?
- Chrome is automated by testing software.
Q 11. Can we minimize the browser?
- No we cannot able to minimize the browser by selenium code.
Q 12. How we can check the title for browser?
- By using getTitle() method we can check the title for browser.
Q 13. What is webpage?
- Webpage is a collection of web elements like textbox, button, radio button, checkbox, select table elements, object, link, title, text etc.
Q 14. What is live functionality?
- The element which shows functionality. The functionality will get refresh this is live.
Q 15. What is dead functionality?
- The element which are not refresh of reload that page then dead.
Q 16. How will create webpage?
- To create web page we need to use html.
- Every keyword should be close brace with angular brace using forward slash.
- To create a component and element we need to use keyword input.
- To create a list box or select table element we need to used select keyword.
- To create a link we use keyword a with href hyper reference.
- To create a web table we need to use keyword table.
Q 17. Why we use id?
- The id stored in id attribute of an HTML dom element. It is unique for every element in the page by design.
- Thus an id can uniquely identify an element.
- To use this feature, we neeed to call the findelement(By id()) method of webdriver class.
Q 18. Why HTML code is required in selenium?
- The reason is selenium webdriver identifies the elements which are there on the application using HTML tags of that application. so, as a selenium resources we should know the basic HTML knowledge to identify the element uniquely.
Q 19. What is the difference between linktext and partial linktext?
- The only difference between linktext and partial linktext is that partial linktext does not look into the exact match of the string value but works on a partial match and linktext look for exact match.
Q 20. How Screenshot will take by selenium webdriver?
- Selenium will take screenshot of body of the page.
- It will take screenshot from below the url.
- It means the desktop/laptop visible screen only that screenshot will taken by selenium webdriver code.
Q 21. Which file we need to import that means which extension?
- Import.org.openga.selenium.webdriver;
Q 22. How will set the focus of frames?
By using below methods:
- driver.switchTo().frame();
- driver.switchTo().defaultContaint();
- driver.switchTo().parentFrame();