SlideShare a Scribd company logo
Selenium Interview Questions with
Answers (Coding based)
Question
Question
How do you take a screenshot in Selenium?
Answer
File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new File("screenshots/error.png"));
Use TakeScreenshot Interface, typecasted to driver instance.
1. Copy Taken screen shot to any file on hard drive.
Question
How do you simulate mouse operations in Selenium?
Answer
To simulate mouse operations in Selenium,
• Choose Actions class under selenium > operations package. Ii is used for
mouse operations. It is a a user-facing API for emulating complex user
gestures.
• Selenium recommends use of this class for Mouse operations.
• It implements the builder pattern: Builds a Composite Action containing all
actions specified by the method calls.
Question
How to select drop down values in Selenium?
Approaches to select drop down?
Answer
We use Select class under selenium > support > ui package to select
and deselect in a dropdown list box. There are multiple approaches to do
so as mentioned:
Approaches
1. selectByIndex(int index) Select the option at the given index.
2. selectByValue(java.lang.String value) Select all options that have a value matching the argument.
3. selectByVisibleText(java.lang.String text) Select all options that display text matching the argument.
Question
How do you simulate Special Keys in Selenium like
Ctrl , Alt etc.
Answer
Enum Keys is used for this purpose.
This is part of selenium package.
Keys.chord(Keys.CONTROL,"c")).perform()
The above code will simulate the behavior of CTRL + C
Question
Tell me how do you work with multiple windows in
Selenium?
Answer
Some web applications have many frames or multiple windows. WebDriver
supports moving between named windows using the “switchTo” method:
driver.switchTo().window("windowName");
You can pass a “window handle” to the “switchTo().window()” method. Knowing
this, it’s possible to iterate over every open window like so:
for (String handle : driver.getWindowHandles())
{
driver.switchTo().window(handle);
}
Question
How do you handle HTML Tables in Selenium?
Answer
1.’table’ tag defines html table.
2.’tbody’ tag defines container for rows and columns.
3.’tr’ defines rows in an html table.
4.’td’/’th’ define column of an html table.
Use tagname locator strategy to identify and extract data
Question
Which is the most effective locator strategy in Selenium?
Answer
CSS works with simple attributes like ID and Class, XPATH will traverse the DOM
top down to work with nested elements, so CSS is faster
CSS are clear and concise. Also Selectors are more readable.
16
THANKS!
Any questions?
You can contact us at
▪ info@techcanvass.com
▪ 022-40155 175
▪ 7738 7731 08
www.techcanvass.com

More Related Content

PDF
Selenium Automation Testing Interview Questions And Answers
PDF
Cucumber questions
DOCX
Selenium interview questions
DOCX
Selenium interview Q&A
PDF
Top trending selenium interview questions
PDF
Selenium interview questions and answers
PDF
Selenium Handbook
PDF
Selenium Webdriver Interview Questions
Selenium Automation Testing Interview Questions And Answers
Cucumber questions
Selenium interview questions
Selenium interview Q&A
Top trending selenium interview questions
Selenium interview questions and answers
Selenium Handbook
Selenium Webdriver Interview Questions

What's hot (20)

PDF
Selenium webdriver interview questions and answers
DOCX
Selenium interview-questions-freshers
PDF
Selenium - Introduction
PPTX
Automation Testing by Selenium Web Driver
PPT
Selenium Concepts
PPT
Selenium
PPTX
Introduction to Selenium Web Driver
PPTX
Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Train...
PDF
Selenium Basics Tutorial
DOCX
Selenium WebDriver FAQ's
DOCX
Ajit jadhav automation_qa_4_ yrs
PDF
Selenium IDE
PPT
Selenium ppt
PPTX
Test Automation and Selenium
PPTX
An overview of selenium webdriver
PPTX
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
PPTX
Selenium test automation
PPTX
Selenium WebDriver training
PPTX
Selenium web driver
PPTX
Introduction to selenium
Selenium webdriver interview questions and answers
Selenium interview-questions-freshers
Selenium - Introduction
Automation Testing by Selenium Web Driver
Selenium Concepts
Selenium
Introduction to Selenium Web Driver
Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Train...
Selenium Basics Tutorial
Selenium WebDriver FAQ's
Ajit jadhav automation_qa_4_ yrs
Selenium IDE
Selenium ppt
Test Automation and Selenium
An overview of selenium webdriver
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
Selenium test automation
Selenium WebDriver training
Selenium web driver
Introduction to selenium
Ad

Similar to Selenium Interview Questions & Answers (20)

PPT
Testing And Drupal
DOCX
What is selenium
PDF
Tellurium At Rich Web Experience2009
DOC
Csharp
PPT
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
PDF
Custom components
PDF
Introduction to Selenium and Test Automation
PDF
Lhy tutorial gui(1)
PDF
How to develop a Graphical User Interface (GUI) in Scilab
PDF
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
PDF
Advanced Selenium Automation with Actions & Robot Class
PPT
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
PPT
Working Effectively With Legacy Code
ODT
Eclipse Tricks
PPTX
Eclipse e4 on Java Forum Stuttgart 2010
PDF
Selenium with testng and eclipse ide
ODP
Alexandre.iline rit 2010 java_fxui_extra
PDF
Re-Design with Elixir/OTP
ODP
Automated ui testing with selenium. drupal con london 2011
PDF
The Ring programming language version 1.8 book - Part 95 of 202
Testing And Drupal
What is selenium
Tellurium At Rich Web Experience2009
Csharp
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Custom components
Introduction to Selenium and Test Automation
Lhy tutorial gui(1)
How to develop a Graphical User Interface (GUI) in Scilab
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Advanced Selenium Automation with Actions & Robot Class
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
Working Effectively With Legacy Code
Eclipse Tricks
Eclipse e4 on Java Forum Stuttgart 2010
Selenium with testng and eclipse ide
Alexandre.iline rit 2010 java_fxui_extra
Re-Design with Elixir/OTP
Automated ui testing with selenium. drupal con london 2011
The Ring programming language version 1.8 book - Part 95 of 202
Ad

More from Techcanvass (20)

PDF
ECBA Exam Questions PDF | ECBA Sample Questions PDF | Techcanvass
PDF
Free CCBA exam questions PDF
PPTX
Selenium web element commands cheat sheet
PPTX
CBAP Certification Overview
PPTX
CCBA Certification Overview
PDF
5 things to do to become a Business Analyst
PDF
Business analysis Fundamentals | Fundamentals of business analysis
PDF
What is Data Dictionary - BABOK technique
PDF
SQL Quick Reference Card
PPTX
IIBA ECBA Certification Exam preparation Strategy
PPTX
User stories basics
PPTX
Business analyst certifications
PDF
CBAP sample questions
PPTX
Selenium Tutorial for Beginners | Automation framework Basics
PPTX
Agile business analyst
PDF
Agile Scrum Quick Reference Card
PDF
CBAP Certification Basics
PPTX
IIBA BABOK version 3 - What's inside
PPTX
Business Analysis Core Concepts Model (BACCM)
PDF
Function point analysis introduction
ECBA Exam Questions PDF | ECBA Sample Questions PDF | Techcanvass
Free CCBA exam questions PDF
Selenium web element commands cheat sheet
CBAP Certification Overview
CCBA Certification Overview
5 things to do to become a Business Analyst
Business analysis Fundamentals | Fundamentals of business analysis
What is Data Dictionary - BABOK technique
SQL Quick Reference Card
IIBA ECBA Certification Exam preparation Strategy
User stories basics
Business analyst certifications
CBAP sample questions
Selenium Tutorial for Beginners | Automation framework Basics
Agile business analyst
Agile Scrum Quick Reference Card
CBAP Certification Basics
IIBA BABOK version 3 - What's inside
Business Analysis Core Concepts Model (BACCM)
Function point analysis introduction

Recently uploaded (20)

PDF
Josh Gao Strength to Strength Book Summary
PPTX
OnePlus 13R – ⚡ All-Rounder King Performance: Snapdragon 8 Gen 3 – same as iQ...
PPTX
Overview Planner of Soft Skills in a single ppt
PDF
Understanding the Rhetorical Situation Presentation in Blue Orange Muted Il_2...
PPTX
1751884730-Visual Basic -Unitj CS B.pptx
PPTX
DPT-MAY24.pptx for review and ucploading
PDF
Why Today’s Brands Need ORM & SEO Specialists More Than Ever.pdf
DOC
field study for teachers graduating samplr
PDF
Sales and Distribution Managemnjnfijient.pdf
PPTX
E-Commerce____Intermediate_Presentation.pptx
PDF
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
PPTX
internship presentation of bsnl in colllege
PPTX
_Dispute Resolution_July 2022.pptxmhhghhhh
PPT
APPROACH TO DEVELOPMENTALlllllllllllllllll
PPTX
FINAL PPT.pptx cfyufuyfuyuy8ioyoiuvy ituyc utdfm v
PPT
notes_Lecture2 23l3j2 dfjl dfdlkj d 2.ppt
PDF
Entrepreneurship PowerPoint for students
PPTX
Surgical thesis protocol formation ppt.pptx
PDF
Prostaglandin E2.pdf orthoodontics op kharbanda
PPTX
Autonomic_Nervous_SystemM_Drugs_PPT.pptx
Josh Gao Strength to Strength Book Summary
OnePlus 13R – ⚡ All-Rounder King Performance: Snapdragon 8 Gen 3 – same as iQ...
Overview Planner of Soft Skills in a single ppt
Understanding the Rhetorical Situation Presentation in Blue Orange Muted Il_2...
1751884730-Visual Basic -Unitj CS B.pptx
DPT-MAY24.pptx for review and ucploading
Why Today’s Brands Need ORM & SEO Specialists More Than Ever.pdf
field study for teachers graduating samplr
Sales and Distribution Managemnjnfijient.pdf
E-Commerce____Intermediate_Presentation.pptx
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
internship presentation of bsnl in colllege
_Dispute Resolution_July 2022.pptxmhhghhhh
APPROACH TO DEVELOPMENTALlllllllllllllllll
FINAL PPT.pptx cfyufuyfuyuy8ioyoiuvy ituyc utdfm v
notes_Lecture2 23l3j2 dfjl dfdlkj d 2.ppt
Entrepreneurship PowerPoint for students
Surgical thesis protocol formation ppt.pptx
Prostaglandin E2.pdf orthoodontics op kharbanda
Autonomic_Nervous_SystemM_Drugs_PPT.pptx

Selenium Interview Questions & Answers

  • 1. Selenium Interview Questions with Answers (Coding based)
  • 2. Question Question How do you take a screenshot in Selenium?
  • 3. Answer File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(src, new File("screenshots/error.png")); Use TakeScreenshot Interface, typecasted to driver instance. 1. Copy Taken screen shot to any file on hard drive.
  • 4. Question How do you simulate mouse operations in Selenium?
  • 5. Answer To simulate mouse operations in Selenium, • Choose Actions class under selenium > operations package. Ii is used for mouse operations. It is a a user-facing API for emulating complex user gestures. • Selenium recommends use of this class for Mouse operations. • It implements the builder pattern: Builds a Composite Action containing all actions specified by the method calls.
  • 6. Question How to select drop down values in Selenium? Approaches to select drop down?
  • 7. Answer We use Select class under selenium > support > ui package to select and deselect in a dropdown list box. There are multiple approaches to do so as mentioned: Approaches 1. selectByIndex(int index) Select the option at the given index. 2. selectByValue(java.lang.String value) Select all options that have a value matching the argument. 3. selectByVisibleText(java.lang.String text) Select all options that display text matching the argument.
  • 8. Question How do you simulate Special Keys in Selenium like Ctrl , Alt etc.
  • 9. Answer Enum Keys is used for this purpose. This is part of selenium package. Keys.chord(Keys.CONTROL,"c")).perform() The above code will simulate the behavior of CTRL + C
  • 10. Question Tell me how do you work with multiple windows in Selenium?
  • 11. Answer Some web applications have many frames or multiple windows. WebDriver supports moving between named windows using the “switchTo” method: driver.switchTo().window("windowName"); You can pass a “window handle” to the “switchTo().window()” method. Knowing this, it’s possible to iterate over every open window like so: for (String handle : driver.getWindowHandles()) { driver.switchTo().window(handle); }
  • 12. Question How do you handle HTML Tables in Selenium?
  • 13. Answer 1.’table’ tag defines html table. 2.’tbody’ tag defines container for rows and columns. 3.’tr’ defines rows in an html table. 4.’td’/’th’ define column of an html table. Use tagname locator strategy to identify and extract data
  • 14. Question Which is the most effective locator strategy in Selenium?
  • 15. Answer CSS works with simple attributes like ID and Class, XPATH will traverse the DOM top down to work with nested elements, so CSS is faster CSS are clear and concise. Also Selectors are more readable.
  • 16. 16 THANKS! Any questions? You can contact us at ▪ [email protected] ▪ 022-40155 175 ▪ 7738 7731 08 www.techcanvass.com