Check Selenium-SDET-UIAutomation Questions set 41-50:
Q&A Set 41-50
To check API related topics and interview tips check below and keep reading:
Most Asked API Question For SDET
Before we start looking into the interview questions and answers let’s understand quickly about Selenium along with the reasons behind the popularity of the same. The most important fact about Selenium is that it has the highest market share in any of the automation solutions available in the market for web automation, and with that fact let’s start our interview preparation with Selenium questions and answers.
What is Selenium?
Selenium is an open source umbrella project for a range of tools and libraries aimed at supporting browser automation. It provides a playback tool for authoring functional tests across most modern web browsers, without the need to learn a test scripting language.
Why do we need Selenium?
Most programmers and developers who build website applications and wish to test them every now and then use Selenium. One of the biggest advantages of Selenium, which has made it so popular, is its flexibility. Any individual who creates web programs can use Selenium to test the code and applications. Further, professionals can debug and perform visual regression tests as per the requirements of the website or code.
In most organisations, it is the job of quality analyst (QA) engineers to test web applications by using Selenium. They are required to write scripts that can help in maximising accuracy and test coverage to make changes in the project and maintain the infrastructure of the test.
- driver.navigate().back()
- driver.navigate().forward()
- driver.navigate().refresh()
2. What is the return type of findelements?
List of elements with similar property
3. Explain some of the strategies you have followed while using xpath?
4. What will happen if no webelement is found for findelements?
It will return an empty list
5. What will happen if no webelement is found for findelement?
It will give error as :NoSuchElementException
7. How to select value from dropdown in selenium?
Using select class as below
Select technology = new Select(driver.findElement(By.xpath("//select[@id='effectTypes']")));
technology.selectByVisibleText("Drop");
8. What are the methods provided in selenium to select from dropdown?
- selectByVisibleText()
- selectByValue()
- selectByIndex()
9. How to fetch text from UI in selenium?
- gettext()
- getAttribute("propertyname")
11. How to get current url,title and page source?
- driver.getCurrentUrl();
- driver.getTitle();
- driver.getPageSource();
12. How to clear text using selenium?
clear() — method is used to clear text from the text area
driver.findElement(By.xpath(“//input[@placeholder=’Username’]”)).clear();
13. How to do Browser Initialization for all types of browsers?
• Firefox
WebDriver driver = new FirefoxDriver();
• Chrome
WebDriver driver = new ChromeDriver();
• Internet Explorer
WebDriver driver = new InternetExplorerDriver();
• Safari Driver
WebDriver driver = new SafariDriver();
28. How to get all cookies and with name of the cookie?
driver.manage().getCookies();
driver.manage().getCookieNamed("APISID");
29. How to delete all cookies and with name of the cookie?
driver.manage().deleteCookieNamed("APISID");
driver.manage().deleteAllCookies();
30. How to add a cookie?
Cookie cookie1 = new Cookie("test2", "cookie2");
************************************************
✍️AUTHOR: LinkedIn Profile
************************************************
Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session
*************************************************
SeleniumWebdriver Automation Testing Interview Questions:
https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html
DevOps Interview Q&A:
https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/Docker
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python