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 WebDriver training
PDF
Automation Testing using Selenium Webdriver
PPTX
An overview of selenium webdriver
PPT
QSpiders - Automation using Selenium
PDF
Selenium IDE LOCATORS
PPTX
Selenium-Locators
PPT
Selenium Concepts
PDF
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
Selenium WebDriver training
Automation Testing using Selenium Webdriver
An overview of selenium webdriver
QSpiders - Automation using Selenium
Selenium IDE LOCATORS
Selenium-Locators
Selenium Concepts
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka

What's hot (20)

PDF
Selenium Maven With Eclipse | Edureka
PPTX
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
PPTX
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
PPT
Selenium Presentation at Engineering Colleges
PPT
Selenium Automation Framework
PPTX
Selenium locators: ID, Name, xpath, CSS Selector advance methods
DOCX
Selenium interview-questions-freshers
PPTX
Angular 14.pptx
PPTX
Unit testing in JavaScript with Jasmine and Karma
PDF
Selenium Webdriver Interview Questions
PDF
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
PPTX
Spring boot
PPTX
Selenium Locators
PPTX
Automation - web testing with selenium
PPTX
Introduction to Selenium Web Driver
PDF
Spring Framework - Core
PPTX
Selenium ppt
PDF
Spring annotation
PPTX
Scripting robot
PPTX
ReactJS presentation.pptx
Selenium Maven With Eclipse | Edureka
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Selenium Presentation at Engineering Colleges
Selenium Automation Framework
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium interview-questions-freshers
Angular 14.pptx
Unit testing in JavaScript with Jasmine and Karma
Selenium Webdriver Interview Questions
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
Spring boot
Selenium Locators
Automation - web testing with selenium
Introduction to Selenium Web Driver
Spring Framework - Core
Selenium ppt
Spring annotation
Scripting robot
ReactJS presentation.pptx
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 with java
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
Dev labs alliance top 50 selenium interview questions for SDET
PPTX
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
PPTX
DevLabs 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
PPT
Selenium (1) (1)
PPTX
Selenium
PPTX
PPTX
Selenium
PPTX
Selenium
PPTX
Selenium
Data driven Automation Framework with Selenium
Selenium Certification
Selenium with java
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
Dev labs alliance top 50 selenium interview questions for SDET
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
DevLabs 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 (1) (1)
Selenium
Selenium
Selenium
Selenium
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)

PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
Download Adobe Photoshop Crack 2025 Free
PPTX
Python is a high-level, interpreted programming language
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PDF
E-Commerce Website Development Companyin india
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
Microsoft Office 365 Crack Download Free
PPTX
Lecture 5 Software Requirement Engineering
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
DNT Brochure 2025 – ISV Solutions @ D365
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Tech Workshop Escape Room Tech Workshop
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Download Adobe Photoshop Crack 2025 Free
Python is a high-level, interpreted programming language
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
E-Commerce Website Development Companyin india
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Full-Stack Developer Courses That Actually Land You Jobs
BoxLang Dynamic AWS Lambda - Japan Edition
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Microsoft Office 365 Crack Download Free
Lecture 5 Software Requirement Engineering
MCP Security Tutorial - Beginner to Advanced
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev

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