SlideShare a Scribd company logo
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain the different exceptions in Selenium WebDriver?
 What is exception test in Selenium?1
TimeoutException Thrown when command does not complete in enough time
NoSuchElementException Thrown when Element with given attribute is not found
ElementNotVisibleException Thrown when Element is present in DOM but not visible
StaleElementException Thrown when Element is deleted or is no longer attached to DOM
Exception Test @Test(expectedException = NoSuchElementException.class)
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Have you used Excel Sheet in your project?2
Excel Sheet is used as Data Source for tests and also contains Data Set for DataDriven Testing
Data Source
- Application URL for all environments
- User name and Passwords for different environments
- Test Cases to be executed
Data Driven Test
- Data for different iterations
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How can you redirect browsing from a browser through some
proxy?3
Selenium provides PROXY class to redirect browsing from a proxy
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is POM (Page Object Model)?
 What are it’s advantages?4
• Page Object Model is a design pattern to create Object Repository for web UI elements.
• Each web page in the application should have corresponding page class.
• Page class will find the WebElements of that web page and also contains Page methods which perform operations
on those WebElements.
Advantages:-
• Keep operations and flows in UI separate from Verification – clean &easy to understand code
• Object Repository independent of Test Cases – multiple tests use same Object Repository
• Reusability of code
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is Page Factory?5
• Page Factory is an inbuilt Page Object Model concept for Selenium WebDriver which is very optimized
• Separation of Page Object Repository and Test Methods
• Page Factory Class provides @FindBy annotation to find WebElements
• @FindBy can accept tagName, partialLinkText, name, linkText, id, css, className & xpath as attributes
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What are the different types of WAIT statements in Selenium
WebDriver?
 How do you achieve synchronization in WebDriver?
6
Implicit Wait
• Instructs the web driver to wait for some time by polling the DOM.
• Once you have declared implicit wait it will be available for the entire life of web driver instance. By default ,the
value will be 0. If you set a longer default, then the behavior will poll the DOM on a periodic basis depending on
the browser/driver implementation.
Explicit Wait - Instructs the execution to wait for some time until some condition is achieved.
Conditions:
- elementToBeClickable
- elementToBeSelected
- presenceOfElementLocated
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Write a code to wait for a particular element to be visible on a page.
 Write a code to wait for an alert to appear.7
WebDriverWait wait=new WebDriverWait(driver, 20);
Element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath( “<xpath”)));
WebDriverWait wait=new WebDriverWait(driver, 20);
Element = wait.until(ExpectedConditions.alertIsPresent();
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is the use of JavaScript Executor?8
JavaScriptExecutor is an interface which provides mechanism to execute Javascript through selenium driver. It
provides “executescript” & "executeAsyncScript" methods, to run JavaScript in the context of the currently selected
frame or window
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(Script,Arguments);
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to scroll down a page using JavaScript in Selenium?
 How to scroll down to a particular element?9
((JavascriptExecutor) driver).executeScript("window.scrollBy(0,500)");
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", element);
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to handle keyboard and mouse actions using Selenium?10
• Handling special keyboard and mouse events are done using the Advanced User Interactions API.
• It contains the Actions and the Action Classes that are needed for executing these events.
• Commonly used keyboard and mouse events provided by the Actions class.
Method Description
clickAndHold() Clicks (without releasing) at the current mouse location.
dragAndDrop() Performs click-and-hold at the location of the source element, moves
source, target() to the location of the target element, then releases the mouse.
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to send ALT/SHIFT/CONTROL key in Selenium WebDriver?
Method: keyDown(modifier_key)
Parameters: Modifier_key (keys.ALT or Keys.SHIFT or Keys.CONTROL)
Purpose: Performs a modifier key press, doesn't release the modifier key. Subsequent interactions may assume it's kept
pressed
Method: keyUp(modifier_key)
Parameters: Modifier_key (keys.ALT or Keys.SHIFT or Keys.CONTROL)
Purpose: Performs a key release.
11
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to send ALT/SHIFT/CONTROL key in Selenium WebDriver?11
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to take screenshots in Selenium WebDriver?12
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to set the size of browser window using Selenium?13
driver.manage().window().maximize(); - To maximize the window
System.out.println(driver.manage().window().getSize());
Dimension d = new Dimension(420,600);
driver.manage().window().setSize(d); - To resize the current window to the given dimension
((IJavascriptExecutor)driver).executeScript("window.resizeTo(1024, 768);"); - To set window to a particular size
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to handle a dropdown in Selenium WebDriver?
 How to select a value from dropdown?14
<select id="mySelect">
<option value="option1">France</option>
<option value="option2">Italy</option>
<option value="option3">Spain</option>
</select>
WebElement mySelectElement = driver.findElement(By.id("mySelect"));
Select dropdown= new Select(mySelectElement);
OR
Select dropdown = new Select(driver.findElement(By.id("mySelect")));
1. dropdown.selectByVisibleText("Italy");
2. dropdown.selectByIndex(2);
3. dropdown.selectByValue(“option3”)
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to switch to a new window (new tab) which opens up after you
click on a link?15
driver.switchTo().window(<windowName>);
driver.switchTo().frame(<iframeName>);
driver.switchTo().alert();
If window name is not available
String handle= driver.getWindowHandle();
for (String handle : driver.getWindowHandles()) {
driver.switchTo().window(handle);}
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How can you fetch an attribute from an element?
 How to retrieve typed text from a textbox?16
WebElement eLogin = driver.findElement(By.name(“Login”);
String LoginClassName = eLogin.getAttribute("classname");
WebElement eLogin = driver.findElement(By.name(“Login”);
String LoginText = Login.GetText ();
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How do you upload a file using Selenium WebDriver?17
<input type="file" name="uploaded_file" size="50" class="pole_plik">
element = driver.find_element_by_id(”uploaded_file")
element.send_keys("C:myfile.txt")
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Can we enter text without using sendKeys()?18
Yes, text can be entered by using JavascriptExecutor.
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById(‘Login').value=‘Test text without sendkeys");
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain how you will login into any site if it is showing any
authentication popup for password and username?19
WebDriverWait wait = new WebDriverWait(driver, 10);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword(**username**, **password**));
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain how you can find broken links in a page using Selenium
WebDriver?20
• Hyperlinks have anchor tags <a>
• Get value of ‘href’ for all anchor tags on page from page source
• Send a http request to each href
• Analyze response to be equal to 200 - OK
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Which technique should you consider using throughout the script
“if there is neither frame id nor frame name”?21
If neither id nor name is present for frame, then select frame by Index.
Example:-
Select a frame by its (zero-based) index. That is, if a page has three frames, the first frame would be at index "0", the
second at index "1" and the third at index "2". Once the frame has been selected, all subsequent calls on the
WebDriver interface are made to that frame.
driver.switchTo().frame(int arg0);
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is the significance of testng.xml?22
A test suite is a collection of test cases.
In TestNG, we cannot define a suite in testing source code, but it is represented by one XML file, as suite is the feature of
execution. It also allows flexible configuration of the tests to be run.
A suite can contain one or more tests and is defined by the <suite> tag.
- Allows execution of multiple test cases from multiple classes
- Allows parallel execution
- Allows execution of test cases in groups where a single test can belong to multiple groups
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is parameterization in TestNG?
 How to pass parameters using testng.xml?23
TestNG allows to define to parameters in the testng.xml file and then reference those parameters in Test Cases.
public class ParameterizedTest1{
@Test
@Parameters("myName")
public void parameterTest(String myName) {
System.out.println("Parameterized value is : " + myName);
}
}
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name=”CustomSuite">
<test name=”CustomTest”>
<parameter name="myName" value=”John"/>
<classes>
<class name="ParameterizedTest1" />
</classes>
</test>
</suite>
 What is parameterization in TestNG?
 How to pass parameters using testng.xml?23
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain data providers in TestNG using an example. Can I call a
single data provider method for multiple functions and classes?24
- DataProviders are used to pass complex parameters or parameters that need to be created from Java (complex
objects, objects read from a property file or a database, etc…)
- @DataProvider marks a method as supplying data for a test method. The annotated method must return an
Object[] where each Object[] can be assigned to parameter list of the test method.
- @Test method that wants to receive data from this DataProvider needs to use a DataProvider name equals to the
name of this annotation.
Yes same DataProvidor can be used in multiple functions and classes by declaring data provider in separate class and
reusing it in multiple classes
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How to skip a method or a code block in TestNG?25
TestNG provides paramter to @Test annotation to enable or disable a test
@Test(enabled = false)
@Test(enabled = true)
Default value is true
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What is soft assertion in Selenium?
 How can you mark a test case as failed by using soft assertion?26
- Soft Assertions are customized error handler provided by TestNG
- Soft Assertions do not through exceptions when assertion fails and continue with next test step
- Used for multiple assertions
To mark a test as failed with soft assertions call assertAll() method at the end of the test
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 How does TestNG allow you to state dependencies?27
Dependency is a feature in TestNG that allows a test method to depend on a single or a group of test
methods.
Method dependency only works if the “depend-on-method” is part of the same class or any of the inherited
base class (i.e. while extending a class).
@Test(dependsOnMethods = { "initEnvironmentTest" })
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain it with an example.28
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 Explain what is Group Test in TestNG?29
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium Interview Questions & Answers
 What are different types of frameworks?
 Which files can be used as data source for different frameworks?30
- Data Driven Framework
- Keyword Driven Framework
- Hybrid Framework
Dataset can be provided using excel, xml, text, csv, etc type of file
Framework Example
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
More Questions??
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Course Details & Customer Reviews
Go to www.edureka.co/testing-with-selenium-webdriver
Get Edureka Certified in Selenium Today!
Radha Muthian says, “I learned Selenium WebDriver and the course
was very helpful to automate the Web Applications. The lifetime
access of classes helps a lot to refer back and download the codes.”
Vijay Krishnan says, “I have attended Selenium Web driver Certification with
Edureka. The trainer has explained all the concepts of the course in detail
manner which was very easy to understand. Worth for the money spent!!!!”
Tom Tully says, “I wanted to learn Selenium Webdriver in a live, real
course, not self paced, so there would be pressure on me to finish.
Edureka accomplished this at a price far lower than an in-person class,
and as far as I know they are the only internet class that has live
lectures on this subject. Teacher was very knowledgeable. I learned
basic use of Selenium. No problem with me being in US and teacher in
India. They have US 800 number.”
Suhas Kashyap says, “The online Course(Selenium Webdriver),
which I took from Edureka was interactive and also helped me to
improve my knowledge on selenium. Further helped me in changing
the job as well. Thanks Edureka Team... :).”
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING

More Related Content

PPTX
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
PDF
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
PPT
Selenium Concepts
PDF
Selenium IDE LOCATORS
PPTX
API Testing Using REST Assured with TestNG
PDF
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
PPTX
Selenium WebDriver training
PPT
Selenium ppt
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
Selenium Concepts
Selenium IDE LOCATORS
API Testing Using REST Assured with TestNG
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
Selenium WebDriver training
Selenium ppt

What's hot (20)

PPTX
Selenium WebDriver
PPSX
Selenium WebDriver
PPTX
Automation Testing by Selenium Web Driver
PPTX
Automation - web testing with selenium
PDF
TestNG - The Next Generation of Unit Testing
PPTX
Robot framework
PPT
Automation With A Tool Demo
PPTX
Belajar Postman test runner
PPTX
API Test Automation Using Karate (Anil Kumar Moka)
PPTX
Selenium- A Software Testing Tool
PPTX
An overview of selenium webdriver
PPT
Selenium Presentation at Engineering Colleges
PDF
Karate - powerful and simple framework for REST API automation testing
PPTX
Test Automation Using Selenium
PDF
Selenium Webdriver Interview Questions
PPTX
test_automation_POC
PPTX
Selenium with java
PPT
Selenium
PDF
Web automation using selenium.ppt
PPTX
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium WebDriver
Selenium WebDriver
Automation Testing by Selenium Web Driver
Automation - web testing with selenium
TestNG - The Next Generation of Unit Testing
Robot framework
Automation With A Tool Demo
Belajar Postman test runner
API Test Automation Using Karate (Anil Kumar Moka)
Selenium- A Software Testing Tool
An overview of selenium webdriver
Selenium Presentation at Engineering Colleges
Karate - powerful and simple framework for REST API automation testing
Test Automation Using Selenium
Selenium Webdriver Interview Questions
test_automation_POC
Selenium with java
Selenium
Web automation using selenium.ppt
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Ad

Similar to Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Training | Edureka (20)

PPTX
Data driven Automation Framework with Selenium
PDF
Selenium Certification
PPTX
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
PDF
Selenium Automation Testing Interview Questions And Answers
PPTX
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
PDF
Designing keyword and Data Driven Automation framework with Selenium
PPTX
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
PPTX
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
PPTX
Dev labs alliance top 50 selenium interview questions for SDET
PPTX
Step by step - Selenium 3 web-driver - From Scratch
PDF
Best automation testing syllabus 2025.pdf
DOCX
Software Testing Tools Training
PPTX
Best java automation training institute in Bangalore - Selenium Labs
PDF
selenium-webdriver-interview-questions.pdf
PPTX
Selenium
PPTX
PPTX
Selenium
PPTX
Selenium
PPTX
Selenium
PPT
Selenium (1) (1)
Data driven Automation Framework with Selenium
Selenium Certification
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium Automation Testing Interview Questions And Answers
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
Designing keyword and Data Driven Automation framework with Selenium
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
Dev labs alliance top 50 selenium interview questions for SDET
Step by step - Selenium 3 web-driver - From Scratch
Best automation testing syllabus 2025.pdf
Software Testing Tools Training
Best java automation training institute in Bangalore - Selenium Labs
selenium-webdriver-interview-questions.pdf
Selenium
Selenium
Selenium
Selenium
Selenium (1) (1)
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
System and Network Administraation Chapter 3
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Essential Infomation Tech presentation.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Nekopoi APK 2025 free lastest update
PPTX
L1 - Introduction to python Backend.pptx
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
System and Network Administraation Chapter 3
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Essential Infomation Tech presentation.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Navsoft: AI-Powered Business Solutions & Custom Software Development
Odoo Companies in India – Driving Business Transformation.pdf
Understanding Forklifts - TECH EHS Solution
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Operating system designcfffgfgggggggvggggggggg
Nekopoi APK 2025 free lastest update
L1 - Introduction to python Backend.pptx
wealthsignaloriginal-com-DS-text-... (1).pdf

Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Training | Edureka

  • 2. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain the different exceptions in Selenium WebDriver?  What is exception test in Selenium?1 TimeoutException Thrown when command does not complete in enough time NoSuchElementException Thrown when Element with given attribute is not found ElementNotVisibleException Thrown when Element is present in DOM but not visible StaleElementException Thrown when Element is deleted or is no longer attached to DOM Exception Test @Test(expectedException = NoSuchElementException.class)
  • 3. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Have you used Excel Sheet in your project?2 Excel Sheet is used as Data Source for tests and also contains Data Set for DataDriven Testing Data Source - Application URL for all environments - User name and Passwords for different environments - Test Cases to be executed Data Driven Test - Data for different iterations
  • 4. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How can you redirect browsing from a browser through some proxy?3 Selenium provides PROXY class to redirect browsing from a proxy
  • 5. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is POM (Page Object Model)?  What are it’s advantages?4 • Page Object Model is a design pattern to create Object Repository for web UI elements. • Each web page in the application should have corresponding page class. • Page class will find the WebElements of that web page and also contains Page methods which perform operations on those WebElements. Advantages:- • Keep operations and flows in UI separate from Verification – clean &easy to understand code • Object Repository independent of Test Cases – multiple tests use same Object Repository • Reusability of code
  • 6. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is Page Factory?5 • Page Factory is an inbuilt Page Object Model concept for Selenium WebDriver which is very optimized • Separation of Page Object Repository and Test Methods • Page Factory Class provides @FindBy annotation to find WebElements • @FindBy can accept tagName, partialLinkText, name, linkText, id, css, className & xpath as attributes
  • 7. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What are the different types of WAIT statements in Selenium WebDriver?  How do you achieve synchronization in WebDriver? 6 Implicit Wait • Instructs the web driver to wait for some time by polling the DOM. • Once you have declared implicit wait it will be available for the entire life of web driver instance. By default ,the value will be 0. If you set a longer default, then the behavior will poll the DOM on a periodic basis depending on the browser/driver implementation. Explicit Wait - Instructs the execution to wait for some time until some condition is achieved. Conditions: - elementToBeClickable - elementToBeSelected - presenceOfElementLocated
  • 8. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Write a code to wait for a particular element to be visible on a page.  Write a code to wait for an alert to appear.7 WebDriverWait wait=new WebDriverWait(driver, 20); Element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath( “<xpath”))); WebDriverWait wait=new WebDriverWait(driver, 20); Element = wait.until(ExpectedConditions.alertIsPresent();
  • 9. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is the use of JavaScript Executor?8 JavaScriptExecutor is an interface which provides mechanism to execute Javascript through selenium driver. It provides “executescript” & "executeAsyncScript" methods, to run JavaScript in the context of the currently selected frame or window JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript(Script,Arguments);
  • 10. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to scroll down a page using JavaScript in Selenium?  How to scroll down to a particular element?9 ((JavascriptExecutor) driver).executeScript("window.scrollBy(0,500)"); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", element);
  • 11. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to handle keyboard and mouse actions using Selenium?10 • Handling special keyboard and mouse events are done using the Advanced User Interactions API. • It contains the Actions and the Action Classes that are needed for executing these events. • Commonly used keyboard and mouse events provided by the Actions class. Method Description clickAndHold() Clicks (without releasing) at the current mouse location. dragAndDrop() Performs click-and-hold at the location of the source element, moves source, target() to the location of the target element, then releases the mouse.
  • 12. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to send ALT/SHIFT/CONTROL key in Selenium WebDriver? Method: keyDown(modifier_key) Parameters: Modifier_key (keys.ALT or Keys.SHIFT or Keys.CONTROL) Purpose: Performs a modifier key press, doesn't release the modifier key. Subsequent interactions may assume it's kept pressed Method: keyUp(modifier_key) Parameters: Modifier_key (keys.ALT or Keys.SHIFT or Keys.CONTROL) Purpose: Performs a key release. 11
  • 13. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to send ALT/SHIFT/CONTROL key in Selenium WebDriver?11
  • 14. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to take screenshots in Selenium WebDriver?12
  • 15. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to set the size of browser window using Selenium?13 driver.manage().window().maximize(); - To maximize the window System.out.println(driver.manage().window().getSize()); Dimension d = new Dimension(420,600); driver.manage().window().setSize(d); - To resize the current window to the given dimension ((IJavascriptExecutor)driver).executeScript("window.resizeTo(1024, 768);"); - To set window to a particular size
  • 16. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to handle a dropdown in Selenium WebDriver?  How to select a value from dropdown?14 <select id="mySelect"> <option value="option1">France</option> <option value="option2">Italy</option> <option value="option3">Spain</option> </select> WebElement mySelectElement = driver.findElement(By.id("mySelect")); Select dropdown= new Select(mySelectElement); OR Select dropdown = new Select(driver.findElement(By.id("mySelect"))); 1. dropdown.selectByVisibleText("Italy"); 2. dropdown.selectByIndex(2); 3. dropdown.selectByValue(“option3”)
  • 17. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to switch to a new window (new tab) which opens up after you click on a link?15 driver.switchTo().window(<windowName>); driver.switchTo().frame(<iframeName>); driver.switchTo().alert(); If window name is not available String handle= driver.getWindowHandle(); for (String handle : driver.getWindowHandles()) { driver.switchTo().window(handle);}
  • 18. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How can you fetch an attribute from an element?  How to retrieve typed text from a textbox?16 WebElement eLogin = driver.findElement(By.name(“Login”); String LoginClassName = eLogin.getAttribute("classname"); WebElement eLogin = driver.findElement(By.name(“Login”); String LoginText = Login.GetText ();
  • 19. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How do you upload a file using Selenium WebDriver?17 <input type="file" name="uploaded_file" size="50" class="pole_plik"> element = driver.find_element_by_id(”uploaded_file") element.send_keys("C:myfile.txt")
  • 20. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Can we enter text without using sendKeys()?18 Yes, text can be entered by using JavascriptExecutor. JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("document.getElementById(‘Login').value=‘Test text without sendkeys");
  • 21. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain how you will login into any site if it is showing any authentication popup for password and username?19 WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.authenticateUsing(new UserAndPassword(**username**, **password**));
  • 22. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain how you can find broken links in a page using Selenium WebDriver?20 • Hyperlinks have anchor tags <a> • Get value of ‘href’ for all anchor tags on page from page source • Send a http request to each href • Analyze response to be equal to 200 - OK
  • 23. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Which technique should you consider using throughout the script “if there is neither frame id nor frame name”?21 If neither id nor name is present for frame, then select frame by Index. Example:- Select a frame by its (zero-based) index. That is, if a page has three frames, the first frame would be at index "0", the second at index "1" and the third at index "2". Once the frame has been selected, all subsequent calls on the WebDriver interface are made to that frame. driver.switchTo().frame(int arg0);
  • 24. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is the significance of testng.xml?22 A test suite is a collection of test cases. In TestNG, we cannot define a suite in testing source code, but it is represented by one XML file, as suite is the feature of execution. It also allows flexible configuration of the tests to be run. A suite can contain one or more tests and is defined by the <suite> tag. - Allows execution of multiple test cases from multiple classes - Allows parallel execution - Allows execution of test cases in groups where a single test can belong to multiple groups
  • 25. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is parameterization in TestNG?  How to pass parameters using testng.xml?23 TestNG allows to define to parameters in the testng.xml file and then reference those parameters in Test Cases. public class ParameterizedTest1{ @Test @Parameters("myName") public void parameterTest(String myName) { System.out.println("Parameterized value is : " + myName); } }
  • 26. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name=”CustomSuite"> <test name=”CustomTest”> <parameter name="myName" value=”John"/> <classes> <class name="ParameterizedTest1" /> </classes> </test> </suite>  What is parameterization in TestNG?  How to pass parameters using testng.xml?23
  • 27. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain data providers in TestNG using an example. Can I call a single data provider method for multiple functions and classes?24 - DataProviders are used to pass complex parameters or parameters that need to be created from Java (complex objects, objects read from a property file or a database, etc…) - @DataProvider marks a method as supplying data for a test method. The annotated method must return an Object[] where each Object[] can be assigned to parameter list of the test method. - @Test method that wants to receive data from this DataProvider needs to use a DataProvider name equals to the name of this annotation. Yes same DataProvidor can be used in multiple functions and classes by declaring data provider in separate class and reusing it in multiple classes
  • 28. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How to skip a method or a code block in TestNG?25 TestNG provides paramter to @Test annotation to enable or disable a test @Test(enabled = false) @Test(enabled = true) Default value is true
  • 29. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What is soft assertion in Selenium?  How can you mark a test case as failed by using soft assertion?26 - Soft Assertions are customized error handler provided by TestNG - Soft Assertions do not through exceptions when assertion fails and continue with next test step - Used for multiple assertions To mark a test as failed with soft assertions call assertAll() method at the end of the test
  • 30. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  How does TestNG allow you to state dependencies?27 Dependency is a feature in TestNG that allows a test method to depend on a single or a group of test methods. Method dependency only works if the “depend-on-method” is part of the same class or any of the inherited base class (i.e. while extending a class). @Test(dependsOnMethods = { "initEnvironmentTest" })
  • 31. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain it with an example.28
  • 32. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  Explain what is Group Test in TestNG?29
  • 33. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium Interview Questions & Answers  What are different types of frameworks?  Which files can be used as data source for different frameworks?30 - Data Driven Framework - Keyword Driven Framework - Hybrid Framework Dataset can be provided using excel, xml, text, csv, etc type of file Framework Example
  • 35. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Course Details & Customer Reviews Go to www.edureka.co/testing-with-selenium-webdriver Get Edureka Certified in Selenium Today! Radha Muthian says, “I learned Selenium WebDriver and the course was very helpful to automate the Web Applications. The lifetime access of classes helps a lot to refer back and download the codes.” Vijay Krishnan says, “I have attended Selenium Web driver Certification with Edureka. The trainer has explained all the concepts of the course in detail manner which was very easy to understand. Worth for the money spent!!!!” Tom Tully says, “I wanted to learn Selenium Webdriver in a live, real course, not self paced, so there would be pressure on me to finish. Edureka accomplished this at a price far lower than an in-person class, and as far as I know they are the only internet class that has live lectures on this subject. Teacher was very knowledgeable. I learned basic use of Selenium. No problem with me being in US and teacher in India. They have US 800 number.” Suhas Kashyap says, “The online Course(Selenium Webdriver), which I took from Edureka was interactive and also helped me to improve my knowledge on selenium. Further helped me in changing the job as well. Thanks Edureka Team... :).”

Editor's Notes