Selenium Interview Questions

Table of Contents

Selenium Interview Questions

1. What is automation testing?

Automation testing is the process of automating the manual testing of the application under test (AUT) or the system under test (SUT). It includes the involvement of testing tools that help us create test scripts, which can be used repeatedly without any human intervention.

2. What is a locator? How can you find elements in Selenium?

 Selenium uses locators to find and match the elements of a web page that it needs to
interact with. There are different types of Selenium locators to identify various web elements on a web page:
 ID
 Name
 Class
 Partial Link
 XPath
 CSS Selector
 Link Text

3. Is Selenium 2.0 different from Selenium 3.0? If so, how?

Selenium RC is called Selenium 2.0, and the integration of Selenium RC and WebDriver as a single tool has formed Selenium 3.0.

4. Mention some of the popular tools used for automation testing ?

 Selenium
 Rational Robot
 HP Unified Functional Testing (UFT)
 IBM Rational Functional Tester

5. What are the test types supported by Selenium?

The test types supported by Selenium are:
Functional testing: It verifies if each function of a software application performs in accordance with specific
requirements. This testing primarily involves black-box testing, and it is not concerned about the source code of
the application.
Regression testing: It is nothing but a full or partial selection of the already executed test cases to be re-executed
to ensure whether the existing functionalities work fine.
For testing web-based applications, Selenium can be used.

6. What is X Path?

While DOM is the recognized standard way for navigating through an HTML element
tree, XPath is the navigation tool used to locate a web element based on its XML path.
XML stands for ‘Extensible Markup Language’ and is used to store, organize, and transport
arbitrary data. It stores data in a key–value pair that is very much similar to HTML tags. Both
being markup languages and falling under the same umbrella, XPath can be used to locate
HTML elements.
The fundamental concept behind locating elements using XPath is traversing between
various elements across the entire page and thus enabling a user to find an element with the
reference of another element.

7. Explain the difference between single slash and double slash in XPath.

 Single slash (/): Single slash is used to create an XPath with an absolute path. In this case, the
XPath would start selection from the document’s start node.
 Double slash (//): Double slash is used to create an XPath with a relative path. In this case, the XPath would start selection from anywhere within the document.

8. Why should you use Selenium for test automation?

Selenium should be used for test automation as it:
Is a free and open-source tool
Has a large user base and community support
Has cross-browser compatibility (Firefox, Chrome, Internet Explorer, Safari, etc.)
Has great platform compatibility (Windows, Mac OS, Linux, etc.)
Supports multiple programming languages (Java, C#, Ruby, Python, Perl, etc.)
Has fresh and regular repository developments
Supports distributed testing

9. Does Selenium have any technical limitations? If so, what are those limitations?

Yes, Selenium has a few limitations:
 Testing of only web applications is possible using Selenium.
 Testing of mobile applications or desktop applications is not possible.
 Captcha and barcode readers cannot be tested using Selenium.
 A third-party tool like TestNGor JUnit should be used to generate reports.
 As Selenium is a free tool, there is no ready vendor support through which users can find
various helping communities.

10. What is an object repository?

 Prior programming language knowledge is expected from users.
An object repository allows testers to accumulate web elements of the application under test
(AUT), along with their locator values, in one or more centralized locations as restricted to hardcoding them within the test scripts.

11. What is the difference between type keys and type commands?

Type Keys() will trigger JavaScript events, while type() won’t. Types Keys collects different value
attributes using JavaScript. Whereas, the type commands imitate an actual user typing.

12. What are the advantages of Selenium?

Selenium is a purely open-source and portable automation testing tool.
It supports different languages such as C#, PHP, Java, Perl, Python, JS, and Groovy.
It also supports different OS, including Windows, Linux, UNIX, and Mac OS.
It provides powerful methods such as Xpath, DOM, and CSS to locate elements.
Since it is an open-source tool, developers can customize the code. Also, the developer
community is supported by Google.

13. Define automation testing, and list down its advantages.

 Automation testing or test automation is the process of automating the testing process by using tools to write and execute test cases without any human intervention. It allows us to create scripts that can be executed frequently and generate detailed test reports of the
application.
 Its advantages are as given below:
 It helps in the performance and functional testing of an application.
 It makes the execution of repeated test cases easy.
 It supports the parallel execution of multiple test cases.
 It boosts the accuracy and efficiency of the application by cutting down the chances of human error.
 It easily performs testing on a large-scale test matrix.
 It saves time and money by reducing the burden of arbitrary tasks.

14. What are the significant changes/upgrades made to various Selenium versions?

Selenium’s first version included only three sets of tools: Selenium IDE, Selenium RC, and Selenium Grid.
There was no WebDriver included in the first version. Later, Selenium WebDriver was introduced and
hence included in Selenium V2. However, as WebDriver got included, the use of Selenium RC was
discouraged with time and is not much in use ever since. Selenium 3 is in use. There are some newly
added Selenium features such as IDE and WebDriver. Selenium 4 is the latest released version.

15. How many types of WebDriver APIs are available in Selenium?

 The following is the list of WebDriver APIs:
 AndroidDriver
 ChromeDriver
 EventFiringWebDriver
 FirefoxDriver
 HTMLUnitDriver
 InternetExplorerDriver
 iPhoneDriver
 iPhoneSimulatorDriver
 RemoteWebDriver

16. What is an exception test in Selenium?

An exception test is a test that looks forward to an exception to be thrown inside a test class. It anticipates the @Test annotation followed by the expected exception name. For
example, @Test(expected Exception = No Such Element Exception . class) is an exception test for missing elements in Selenium.

17. What is POM (Page Object Model)? What are its advantages?

Page Object Model is a design pattern used to create object repositories for the web UI
elements. Every web page of an application has a corresponding page class that is responsible
for locating the web elements and performing actions on them.
Its advantages are as follows:
It provides support to separate operations and flows on the UI from verification, hence
improving code readability.
As the object repository is independent of test cases, multiple tests can use the same object
repository.
It increases the reusability of the code
That’s all for the basic Selenium Java interview questions. Let’s move on to the next section of
intermediate Selenium WebDriver interview questions.

18. What are the different types of annotations used in Selenium? Explain the JUnit annotation linked with Selenium.

 In Java, a special form of syntactic metadata can be added to Java source code, which is known as ‘annotations’.Variables, parameters, packages, methods, and classes are annotated. Some of the JUnit annotations are:
 Test
 Before
 After
 Ignore
 Before Class
 After Class
 Run With

19. Why do testers choose Selenium over QTP?

Selenium is more widely used than QTP since:
 Selenium is an open-source tool, whereas QTP is a profitable tool
 Selenium is used specifically for testing web-based applications, while QTP can be used for testing client–server applications too
 Selenium supports multiple browsers like Firefox, IE, Opera, Safari, etc. and has multiple
operating systems compatibility too. Selenium-supported OS platforms are Windows, Mac,
Linux, etc. On the other hand, QTP is limited to Internet Explorer on Windows
 Selenium supports multi-programming language compatibility. Languages supported by
Selenium are Python, Ruby, Perl, etc. But, QTP supports only VBScript

20. What are the four elements that you have to pass in Selenium?

 Four parameters that need to be passed in Selenium are:
o Host
o Port number
o Browser
o URL

21. What is Same-origin Policy? How can we avoid it?

 The ‘Same-origin Policy’ is introduced for security reasons.
It ensures that the content of our site will never be accessible by a script from another site.
As per the policy, any code loaded within the browser can only operate within that website’s
domain.

22. What are data-driven framework and keyword-driven framework?

A data-driven framework in Selenium is an approach of separating a ‘dataset’ from the actual ‘test case’ (code). This framework is completely dependent on the input test data. The test data is inserted from external sources, such as from an Excel file, a CSV file, or from any database. It also allows us to easily control how much data needs to be tested. We can easily increase the number of test parameters by adding more username and password fields to the Excel file (or other sources).
A keyword-driven framework is an extension to the data-driven testing framework in the sense that it not only isolates the test data from the scripts but also keeps the particular section of the code belonging to the test script in an external data file. These sets of code are known as keywords, and hence the framework is so named. Keywords are self-guiding and work based on what actions need to be performed on the application.

23. How will you use Selenium to upload a file?

If the file is on the same machine or in a mapped network drive, it is really straightforward: We have to just type the ‘path’ of the file in the FileUpload control.

24. What is the difference between getwindowhandles() and getwindowhandle()?

 getwindowhandles(): It is used to get the address of all open browsers, and its return data type is Set<String>.
 getwindowhandle(): It is used to get the address of the current browser where the control is, and its return type is a string data type.

25. What is Selenese, and what are the three types of Selenese?

 Selenese is a set of commands in Selenium used for running a test.
 Three types of Selenese are as follows
First, select ‘Toggle Breakpoint’ by right-clicking on the command in Selenium IDE
 Then, press ‘B’ on the keyboard and select the command
 The same step should be repeated for deselecting a breakpoint

26. How do you launch the web browser using WebDriver?

The following syntax can be used to launch the browser corresponding to the system’s
operating system:
webdriver driver =new firefox driver ().

27. List down some of the technical challenges with Selenium.

• Testing a Windows application: Selenium is just a web-based driver. It does not support Windows-based apps and only supports web apps.
• Testing mobile apps: With the help of Selenium, we can test web apps on any OS and browser that run on desktops. But, we cannot test mobile apps with Selenium because it does not work with OS such as Android and iOS
• Limited reporting: It is one of the key challenges. In Selenium, we cannot generate efficient and accurate reports.
• Handling dynamic elements: With the surge in the use of web apps, the management of dynamic elements should be as much efficient as possible. When a web page loads, the content present on the page changes depending on the user, location, and other factors. Most of today’s web apps are dynamic in nature for better user experience, e.g., e-commerce websites. In Selenium automation, the handling of dynamic web content is a major challenge.
• Handling page load: Some of the web pages in a web app are user-specific. They load elements depending on the user.
• Handling pop-up windows: Whenever any simple, prompt, or confirmation alert pops up, it is difficult to automate it.
28. What are the different types of waits available in WebDriver?
There are two types of waits available in WebDriver:
• Implicit wait: These waits are used to provide a default waiting time (say, 30 seconds)
between the consecutive test steps across the entire test script. Hence, the subsequent test step would only be executed when the 30 seconds are over after executing the previous test step.
• Explicit wait: These waits are used to halt the execution until a particular condition is met or the maximum time has elapsed.

29. How do you handle a frame in WebDriver?

 Test Execution Sequence:
Method1
Method2
Method3

30. What are the different types of frameworks?

 Different types of frameworks are as follows:
 Module-based testing framework: This framework divides the entire application under
test (AUT) into a number of logical and isolated modules.
 Library architecture testing framework: Instead of dividing AUT into test scripts, with
this framework, we segregate the application into functions or rather common
functions that can be used by the other parts of the application as well.

31. Describe the difference between Selenium and QTP.

Feature Selenium Quick Test Professional
(QTP)
Browser compatibility It supports almost all
popular browsers: Firefox,Chrome, Safari, Internet Explorer, Opera, etc.QTP supports InternetExplorer, Firefox, and Chrome. It only supports Windows operating system
Distribution It is distributed as an open-source tool and is freely available It is distributed as a licensed tool and is commercialized Application under test (AUT) It supports the testing of web-based applications only It supports the testing of both web-based and
Windows-based applications Object repository Object repository needs to be created as a
separate entity in Selenium QTP automatically creates and maintains the object repository
Language support It supports multipleprogramming languages like Java, C#, Ruby, Python, Perl, etc. It supports only VBScript Vendor support As Selenium is a free tool, users would not get the vendor’s support in troubleshooting issues Users can easily get the vendor’s support if they face any issues

32. In Selenium, what are breakpoints and start points?

Breakpoints: Breakpoints are used to stall the execution of the test. The execution will stop
whenever a breakpoint is implemented, and this will help us check whether the code is
working properly or not.
Start points: Start points are the points from where the execution should begin. Start points
can be used when we want to run the test script from the middle of the code or after a
breakpoint.

33. Mention the need for session handling while working with Selenium.

While working with Selenium, we need session handling. This is because, during test execution,
Selenium WebDriver has to interact with the browser all the time to execute the given
commands. It is also possible that, before the current execution completes, someone else
starts the execution of another script in the same machine and in the same type of browser. So, to avoid such a situation, we need session handling.

34. Mention the types of listeners in TestNG?

The types of listeners in TestNG are:
• IAnnotationTransformer
• IConfigurable
• IConfigurationListener
• IExecutionListener
• IHookable
• IInvokedMethodListener
• IInvokedMethodListener2
• IMethodInterceptor
• IReporter
• ISuiteListener
• ITestListener

35. How can we handle Windows-based popups with Selenium?

Selenium solely supports web application testing. It does not support the testing of
Windows-based applications or mobile applications. To handle Windows-based popups,
third-party intervention is required. AutoIt and Robot Class are examples of third-party
tools that we can use alongside Selenium to handle Windows-based popups.

36. For the database testing in Selenium WebDriver, what API is required?

For the database testing in Selenium WebDriver, we need the JDBC (Java Database Connectivity)
API. It allows us to execute SQL statements.

37. How can you identify an object in Selenium?

We can use isElementPresent (string locator) to find an object in Selenium. It takes
a locator as the argument and, if found, returns a Boolean.

38. How can you identify an object in Selenium?

We can use isElementPresent (string locator) to find an object in Selenium. It takes a
locator as the argument and, if found, returns a Boolean.

39. Mention the use of XPath in Selenium testing.

XPath is used to define web elements on a web page. The major advantage of XPath
is that it helps us in identifying the elements dynamically.
There are two types of XPath:
o Absolute XPath
o Relative XPath

40. What is Selenium?

Selenium is a popular open-source software that is used to automate
web-based applications. It is a set of multiple software tools, and each
tool has a different approach to automated testing.
Selenium has four major components, namely:
Selenium Integrated Development Environment
o Selenium Remote Control
o Selenium WebDriver
o Selenium Grid

41. Can WebDriver test mobile applications?

No, WebDriver is a testing tool used for web-based applications. So, we cannot test
mobile applications with Selenium WebDriver.

42. Explain how Selenium Grid works.

 Selenium Grid creates a test suite that works by forwarding test cases to the hub,
and from there, the test cases are redirected to Selenium WebDriver. WebDriver will
then execute them in the browser. The test suite allows for running tests in parallel.
 Hope you find our comprehensive blog on Selenium testing interview questions
useful. Do let us know in the comments section if you could make use of these
Selenium topics for the interview.

43. Explain the difference between driver.close() and driver.quit() commands in Selenium?

The following is the major difference between both commands:
close() command closes the currently active browser window, which is being used by
the user or which is currently accessed by the web driver.
 quit() command closes all the windows opened by the program, unlike the driver.close
() command.

44. Explain the difference between findElement() and findElements() in Selenium?

The difference between findElement() and findElements() is as follows:
 findElement(): It finds one particular element within the current page using the locating
mechanism. It returns the first element located by the locator.
 findElements(): It finds all the elements within the current page with the help of the
locating mechanism. Hence, it returns a list of matching web elements found by the
locator.

45. Mention the types of navigation commands.

 navigate().back(): It takes the user back to the previous or the last-used web page,
according to the history.
 navigate().forward(): It takes the user to the next web page, according to the browser
history.
 navigate().refresh(): It allows the user to refresh the current web page by reloading all the web elements.
 navigate().to(): It takes the user to a new web page in a new window, depending on the URLspecified.

46. How do you find broken links in Selenium WebDriver?

We can detect whether the given links are broken or not by using the following process:
1.First, accumulate all the links present on a web page using the <a> anchor tag. For each <a> tag, use the attribute ‘h r e f’ value to obtain the hyperlink
2. Send HTTP requests for each link and verify the HTTP response code
3. Based on the HTTP response code, determine if the link is valid or broken. Then, use the
driver.get() method to navigate to a URL, which will respond with a status of 200 – OK (200 – OK indicates that the link is working). If we get any other status, then it indicates that the link is broken
4. Repeat the same process for all the links captured

47.What type of tests have you automated?

Our main focus is to automate test cases to do Regression testing, Smoke & Sanity
testing. Sometimes based on the project and the test time estimation, we do focus on
End to End testing.

48.How many test cases you have automated per day?

Well, the number depends on the complexity of the test cases. When the
complexity was limited, I was able to automate 5 to 6 test cases per day.
Sometimes, I was able to automate only one test case for complex scenarios.

49. What is a Framework?

framework defines a set of rules or best practices that we can follow in a
systematic way to achieve the desired results. There are different types of
automation frameworks and the most common ones are:
Data-Driven Testing Framework
 Keyword Driven Testing Framework
 Hybrid Testing Framework
 Behavioural Driven Framework

50. What type of test cases to be automated?

• Data-driven test cases
• Test cases with higher complexity
• Test case with many database updates
• The test execution rate is high
• Smoke/Critical tests
• Tests with several combinations
• Graph test cases
• Higher manual execution time

53. What type of test cases not to be automated?

• Subjective Validation
• New Functionalities
• Strategic Development
• User Experience
• Complex Functionality
• Quality Control
• Low return on investment
• Installation and setup testing

54. What are the advantages of the Test Automation Framework?

Reusability of code.
Easy reporting.
Low-cost maintenance.
Maximum Coverage
Minimal manual intervention

55.Have you created any Framework?

 If you are a beginner: You can say “No, I didn’t get a chance to create a framework
from the scratch. I have used the framework which is already available. My
contribution is mostly in creating test cases by using the existing framework.”
 If you are a beginner but have good knowledge of creating framework: You can say
“Yes, I have involved in developing framework along with other automation testers
in my company.”
 If you are an experienced tester: You can say “I have contributed to developing
framework.” or You can say “Yes, I have created a framework from the scratch. There
was no automation process in my previous company. I designed the framework from
the scratch.”

56.Why do you prefer Selenium Automation Tool?

 Free and open source – It is a free open source tool. There is no need to allot budget for
this tool
 Help – Have large user base and helping communities.
 Cross-browser compatibility – It works on almost all popular browsers such as Chrome,
Firefox, Internet Explorer, and Safari.
 Cross Platform compatibility – It works on platforms such as Windows, Linux, Mac.
 Multiple programming languages – It supports programming languages such as Java,
Phyton, Perl, Php, C#, Ruby, etc.,
 Parallel Execution – Selenium Grid supports parallel execution of Selenium Scripts.
 Continuous Integration – We can achieve nightly execution using Jenkins.

57. What is Selenium?

Selenium is an open source (free) automated testing suite to test web applications. It
supports different platforms and browsers. It has gained a lot of popularity in terms of webbased automated testing and giving a great competition to the famous commercial tool HP
QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).
I. Selenium IDE (Selenium Integrated Development Environment)
II. Selenium RC (Selenium Remote Control)
III. Selenium WebDriver
IV. Selenium Grid

58.What is Selenium IDE?

Selenium IDE (Integrated Development Environment) is a Firefox plugin. It is the simplest
framework in the Selenium Suite. It allows us to record and playback the scripts. Even
though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium
WebDriver to write more advanced and robust test cases.

59.What is Selenese?

Selenese is the language that is used to write test scripts in Selenium IDE.

60.Which is the only browser that supports Selenium IDE to be used?

Firefox and Chrome. However, as Selenium IDE is community-powered, regular updates and compatibility with new browser versions cannot be ensured.
Back in 2017 when it no longer worked with Firefox’s latest version, users switched to Katalon Recorder. It supports the same commands, extension scripts, data-driven testing, and advanced test reporting platform with TestOps.

61.What is Selenium RC?

Selenium RC AKA Selenium Remote control / Selenium 1. Selenium Remote Control was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. Selenium 1 is still actively supported (in maintenance mode). It relies on JavaScript for automation. It supports Java, Javascript, Ruby, PHP, Python, Perl, and C#. It supports almost every browser out there.

62.What is Selenium WebDriver?

Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts
commands and sends them to a browser. It is implemented through a browser-specific
driver. It controls the browser by directly communicating with it. Selenium WebDriver
supports Java, C#, PHP, Python, Perl, Ruby.

63.What is the difference between Selenium 3 and Selenium 4?

We all know that Selenium 4 was released as a stable version on October 13, 2021. So here in this
post, we have covered Selenium 4 Interview Questions & Answers. First Let’s see the difference
between Selenium 3 and Selenium 4.

64. What is Selenium Grid?

Selenium Grid is a tool used together with Selenium RC to run tests on different machines
against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems
In simple words, it is used to distribute your test execution on multiple platforms and
environments concurrently.

65.When do you use Selenium Grid?

Selenium Grid can be used to execute same or different test scripts on multiple platforms
and browsers concurrently so as to achieve distributed test execution

66.What are the advantages of Selenium Grid?

It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform

67.What is a hub in Selenium Grid?

A hub is a server or a central point that controls the test executions on different machines.

68.What is a node in Selenium Grid?

Node is the machine which is attached to the hub. There can be multiple nodes in
Selenium Grid.

69. What are the types of WebDriver APIs available in Selenium?

Firefox Driver
Gecko Driver
InternetExplorer Driver
Chrome Driver
HTMLUnit Driver
Opera Driver
Safari Driver
Android Driver
iPhone Driver
EventFiringWebDriver

70.Which WebDriver implementation claims to be the fastest?

The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the
HTMLUnitDriver does not execute tests in the browser. Starting a browser and running test
cases took more time compared to running the scripts without a browser. HTMLUnitDriver
took a simple HTTP request-response mechanism for test case execution.

71. Which language is not supported by selenium?

Selenium supports all major programming languages such as Java, C#, Perl, Python, Ruby,
PHP, Scala and Groovy. As of today, others are not compatible.

72.What are the testing types that can be supported by selenium?

Testing types that can be supported by Selenium are as follows:
• Functional Testing
• Regression Testing
• Retesting
• Acceptance Testing
• End-to-End Testing
• Smoke Testing
• Sanity Testing
• Responsive Testing
• Cross Browser Testing
• UI Testing
• Integration Testing

73.How many parameters can selenium commands have at minimum?

There are four parameters that you have to pass in Selenium are
• Host
• Port Number
• Browser
• URL

74. What is an XPath?

XPath is used to locate the elements. Using XPath, we could navigate through elements and
attributes in an XML document to locate web elements such as textbox, button, checkbox, Image etc., in a web page.

75.When you use these locators ID, Name, XPath, Or CSS Selector?

ID & Name locators will be used when there are unique identifiers & unique names available on the web page.
CSS Selector can be used for performance and when ID & Name locators are not unique.
XPath is used when there is no preferred locators.

76.What is the difference between “/” and “//”

Single Slash “/” – Single slash is used to create XPath with absolute path i.e. the XPath would be created to start selection from the document node/start node.
Double Slash “//” – Double slash is used to create XPath with relative path i.e. the XPath would be created to start selection from anywhere within the document.

76. What is the difference between Absolute Path and Relative Path?

Absolute XPath starts from the root node and ends with desired descendant element’s
node. It starts with top HTML node and ends with input node. It starts with a
single forward slash(/) as shown below.

77.What should you do when even XPath functions can’t identify the web element?

In the early stages of software develop ment, developers change identifiers and elements quite often. During the execution, the web elements may change dynamically and we cannot identify the web elements. To overcome this we use XPath axes along with XPath functions.

78.What are XPath Axes?

 XPath axes are used to search for the multiple nodes in the XML document from the context (current) node.
 XPath axes are used to find dynamic elements that would otherwise be impossible using
standard locators.

79.What is a Context Node?

The context node is the node the XPath processor is currently looking at.

80. What is the difference between Assert and Verify in Selenium?

Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.
 Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.

81.What are Soft Assert and Hard Assert in Selenium?

Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an

82.What is the difference between set Speed () and sleep () methods?

 Both sleep() and set Speed() are used to delay the execution speed.
 Set Speed(): It set up speed that will apply a delay time before every Selenium operation.
 Example: set Speed(“5000”) – It waits for 5 seconds
 sleep(): It set up wait only for once when called in our Selenium script.
 Example: sleep(5000) – It waits for 5 seconds
 Note: set Speed method is applicable to Selenium IDE and Selenium RC. We cannot use set Speed in Selenium WebDriver.

83. What are the verification points available in Selenium?

In Selenium IDE, we use Selenese Verify and Assert Commands as Verification points
In Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style. some of the Verification points are
 To check for page title
 To check for certain text
 To check for certain element (text box, button, drop down, etc.)

84.How to launch a browser using Selenium WebDriver?

WebDriver is an Interface. We create an Object of a required driver class such as FirefoxDriver, ChromeDriver, InternetExplorerDriver etc.,

85.What is the super interface of WebDriver?

Search Context acts as the super interface of Web Driver.

86.What is Web Element selenium?

Web Element in Selenium represents an HTML element. It basically represents a DOM element in a HTML document.

87. What are the different exceptions you have faced in Selenium WebDriver?

Some of the exceptions I have faced in my current project are
1. ElementNotVisibleException
2. StaleElementReferenceException
Element Not visible Exception:
This exception will be thrown when you are trying to locate a particular element on webpage that is
not currently visible eventhough it is present in the DOM. Also sometimes, if you are trying to locate
an element with the xpath which associates with two or more element.
Stale Element Reference Exception:
A stale element reference exception is thrown in one of two cases, the first being more common
than the second.
1. The element has been deleted entirely.
2. The element is no longer attached to the DOM.
We face this stale element reference exception when the element we are interacting is destroyed
and then recreated again. When this happens the reference of the element in the DOM becomes
stale. Hence we are not able to get the reference to the element.

88. How to handle STALEELEMENTREFERENCEEXCEPTION?

Before looking how to handle Stale Element Reference Exception through Page Object Model.
Let’s see what is Stale Element Reference Exception first.
Stale means old, decayed, no longer fresh. Stale Element means an old element or no longer available element. Assume there is an element that is found on a web page referenced as a WebElement in WebDriver. If the DOM changes then the Web Element goes stale. If we try to interact with an element which is staled then the StaleElementReferenceException is thrown.

89.What are the types of waits available in Selenium WebDriver?

In Selenium we could see three types of waits such as Implicit Waits, Explicit Waits and Fluent
Waits.

90.What is Implicit Wait In Selenium WebDriver?

Implicit waits tell to the WebDriver to wait for a certain amount of time before it throws an
exception. Once we set the time, WebDriver will wait for the element based on the time we set
before it throws an exception. The default setting is 0 (zero). We need to set some wait time to
make WebDriver to wait for the required time.

91.What is WebDriver Wait In Selenium WebDriver?

Web DriverWait is applied on a certain element with defined expected condition and time. This wait is only applied to the specified element. This wait can also throw an exception when an element is not found.

92. What is Fluent Wait In Selenium WebDriver?

FluentWait can define the maximum amount of time to wait for a specific condition and frequency with which to check the condition before throwing an “ElementNotVisibleException” exception.

93.What happen if you mix both implicit wait and explicit wait in a Selenium Script?

 As per the official Selenium documentation, it is suggested not to mix both Implicit waits and Explicit Waits. Mixing both of them can cause unpredictable wait times.
 Implicit wait is defined only once in the code. It will remain same throughout the driver object instance.
 Explicit wait is defined whenever it is necessary in the code. This wait will call at the time of execution. It is a conditional wait.
 Explicit wait will overwrite the implicit wait where ever explicit wait is applied. So, Explicit Wait gets first preference then Implicit Wait.

94.What happen if you mix both Thread . Sleep and WebDriver Waits in a Selenium Script?

Thread . sleep() method can be used to pause the execution for specified time in milliseconds If we use WebDriver waits along with Thread . sleep() method then webdriver will hold the execution for specified time and then will follow other wait. Test execution time will become more, if we mix both waits.

95. Is Selenium Server needed to run Selenium WebDriver Scripts?

When we are distributing our Selenium WebDriver scripts to execute using Selenium
Grid, we need to use Selenium Server.

96.How can we maximize browser window in Selenium?

To maximize browser window in selenium we use maximize() method. This method maximizes the
current window if it is not already maximized

97.How to delete cookies in Selenium?

You can use get Cookies method(driver . manage(). Get Cookies();) and check if they exist or not . You can also try to grt the cookie by it specific name.

98.What is the difference between driver.close() and driver.quit() methods?

 Purpose of these two methods (driver.close and driver.quit) is almost same. Both allow us to close a browser but still, there is a difference.
 driver.close(): To close current WebDriver instance
driver.quit(): To close all the opened WebDriver instances

99.What Is The Difference Between MaxSessions Vs. MaxInstances Properties in Selenium Grid?

MaxInstances is the no. of browser instances of the same version of the browser that can run on the remote machine.

100. What is the difference between driver.findElement() and driver.findElements() commands?

The difference between driver.findElement() and driver.findElements() commands is-
• findElement() returns a single WebElement (found first) based on the locator passed as parameter.
Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.
• Syntax of findElement()- WebElement textbox = driver.findElement(By.id(“textBoxLocator”));Syntax of findElements()-
List <WebElement> elements = element.findElements(By.id(“value”));
• Another difference between the two is- if no element is found then findElement() throws
NoSuchElementException whereas findElements() returns a list of 0 elements.

101.How to find whether an element is displayed on the web page?

WebDriver facilitates the user with the following methods to check the visibility of the web
elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.

102.How to capture Screenshot in Selenium WebDriver?

Test cases may fail while executing the test scripts. While we are executing the test cases manually we just take a screenshot and place in a result repository. The same can be done by using Selenium WebDriver.

103. How can we handle Web-based Pop-ups or Alerts in Selenium?

To handle Web-based alerts or popups, we need to do switch to the alert window and call
Selenium WebDriver Alert API methods.
dismiss(): To click on Cancel button.
accept(): To Click on OK button.
Get Text(): To get the text which is present on the Alert.
Send Keys(): To enter the text into the alert box.

104.How can we handle windows based pop up?

Selenium doesn’t support windows based applications. It is an automation testing tool which supports only web application testing. We could handle windows based popups in Selenium using some third party tools such as Auto IT, Robot class etc.

105.How to handle hidden elements in Selenium WebDriver?

We can handle hidden elements by using java Script executor

106. How do you read test data from excels?

Test data can efficiently be read from excel using JXL or POI API. POI API has many advantages than JXL.
Click here to see a practical example of using Apache POI.

107.Is it possible to automate the cap tcha using Selenium?

No, It’s not possible to automate captcha and bar code reader.

108.Can You Use Selenium For Rest API Testing Or Web Services Testing?

Simple answer for this is Selenium is not a tool for API Testing. It automates web browsers. Rest API & Web Services contains no UI. So we cannot automate using Selenium.

109.How to handle Ajax calls in Selenium WebDriver?

Handling AJAX calls is one of the common issues when using Selenium WebDriver. We wouldn’t know when the AJAX call would get completed and the page has been updated. In this post, we see how to handle AJAX calls using Selenium.
1. Bitmap comparison is not possible using Selenium WebDriver
2. Automating Captcha is not possible using Selenium WebDriver
3. We can not read bar code using Selenium WebDriver

110.List some scenarios which we cannot automate using Selenium WebDriver?

Two-factor authentication. Another scenario that you shouldn’t automate through UI is two-factor authentication (or 2FA). …

111. What is Object Repository in Selenium WebDriver?

Object Repository is used to store element locator values in a centralized location instead of hard coding them within the scripts. We do create a property file (.properties) to store all the element locators and these property files act as an object repository in Selenium WebDriver.

112.How you build Object Repository in your project?

In QTP, there is an Object Repository concept. When a user records a test, the objects and its properties are captured by default in an Object Repository. QTP uses this Object Repository to play back the scripts. Coming to Selenium, there is no default Object Repository concept. It doesn’t mean that there is no Object Repository in Selenium. Even though there is no default one still we could create our own. In Selenium, we call objects as locators (such as ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, XPath, and CSS). Object repository is a collection of objects. One of the ways to create Object Repository is to place all the locators in a separate file (i.e., properties file)

113.What is Page Object Model in Selenium?

Page Object Model is a Design Pattern which has become popular in Selenium Test Automation. It is widely used design pattern in Selenium for enhancing test maintenance and reducing code duplication. Page object model (POM) can be used in any kind of framework such as modular, data

driven, keyword driven, hybrid framework etc. A page object is an object-oriented class that servesas an interface to a page of your Application Under Test(AUT). The tests then use the methods of this page object class whenever they need to interact with the User Interface (UI) of that page. The benefit is that if the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change. Subsequently, all changes to support that new UI is located in one place.

114. What is Page Factory?

We have seen that ‘Page Object Model’ is a way of representing an application in a test
framework. For every ‘page’ in the application, we create a Page Object to reference the ‘page’ whereas a ‘Page Factory’ is one way of implementing the ‘Page Object Model’.

115.What is the difference between Page Object Model (POM) and Page Factory?

Page Object is a class that represents a web page and hold the functionality and members.
Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it.

116.What are the advantages of Page Object Model Framework?

Code reusability – We could achieve code reusability by writing the code once and use it in different tests. Code maintainability – There is a clean separation between test code and page specific code such as locators and layout which becomes very easy to maintain code. Code changes only on Page Object Classes when a UI change occurs. It enhances test maintenance and reduces code duplication. Object Repository – Each page will be defined as a java class. All the fields in the page will be defined in an interface as members. The class will then implement the interface.
Readability – Improves readability due to clean separation between test code and page specific code

117. How to Upload a file in Selenium WebDriver?

There are two cases which are majorly used to upload a file in Selenium WebDriver such
as using SendKeys Method and using AutoIT Script.

118.How to Download a file in Selenium WebDriver?

By using AutoIT script, we could download a file in Selenium WebDriver.

119.How to connect a Database in selenium?

As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.

120.How To Resize Browser Window Using Selenium WebDriver?

To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window.

121.How To Scroll Web Page Down Or UP Using Selenium WebDriver?

JavaScript scrollBy() method scrolls the document by the specified number of pixels.

122. How To Perform Right Click Action (Context Click) In Selenium WebDriver?

We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action.

123.How To Perform Double Click Action In Selenium WebDriver?

We use Actions class to do Double click action in selenium.

124.How To Perform Drag And Drop Action in Selenium WebDriver?

In some applications, we may face a situation to automate drag and drop an item from one
location to another location. We could not achieve these using basic elements. Selenium has provided an “Actions” class to handle this kind of scenarios. We overcome this kind of scenarios such as drag and drop using Actions Class.

125.How To Highlight Element Using Selenium WebDriver?

By using JavascriptExecutor interface, we could highlight the specified element

126.Have you used any crossbrowsertesting tool to run selenium scripts on cloud?

I have used BrowserStack to run selenium tests on multiple browsers & Multiple operating systems in parallel. Earlier we have made a video on how to use BrowserStack to run selenium scripts on the cloud. Find the link in the description below.

127. What is desired capabilities?

In Selenium we use desired capabilities to handle SSL certificates in chrome browser
We need to create an instance of DesiredCapabilities

128.What is Continuous Integration?

Continuous Integration is abbreviated as CI. Continuous Integration is a development practice that aims to make sure the correctness of software. After each commit, a suite of tests run automatically and test the software to ensure whether the software is running without any breaks. If any test fails, we will get immediate feedback say “build is broken”.

129.Name some CI tools available in the Market?

 Selenium
 Katalon Studio
 Appium
 Unified Functional Testing
 Travis CI
 Egg Plant
 Watir
 Tricentis Tosca
 Test Sigma
 IBM Rational Functional Tester
 Test Complete
 QuerySurge
 JMeter
 Jenkins
 Bamboo
 Docker
 PagerDuty
 JIRA
 GitHub

130. How to achieve Database testing in Selenium?

As we all know Selenium WebDriver is a tool to automate User Interface. We could only interactwith Browser using Selenium WebDriver.
Sometimes, we may face a situation to get the data from the Database or to modify
(update/delete) the data from the Database. If we plan to automate anything outside the vicinityof a browser, then we need to use other tools to achieve our task. To achieve the Database connection and work on it, we need to use JDBC API Driver.

131.What is TestNG?

TestNG is a testing framework designed to simplify a broad range of testing needs, from unittesting to integration testing.

132.What is TestNG Assert and list out some common Assertions supported by TestNG?

TestNG Asserts help us to verify the condition of the test in the middle of the test run. Based on the TestNG Assertions, we will consider a successful test only if it is completed the test run without throwing any exception.
 assertEqual(String actual,String expected)
 assertEqual(String actual,String expected, String message)
 Assert Equals(boo lean actual , boo lean expected)
 Assert True(condition)
 assertTrue(condition, message)
 Assert False(condition)
 Assert False(condition, message)

133. How to create and run TestNG.xml?

In TestNG framework, we need to create TestNG XML file to create and handle multiple test
classes. We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the XML file.

134.How to set test case priority in TestNG?

We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order.

135.How to run a group of test cases using TestNG?

TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set. This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.

136.What is the use of @Listener annotation in TestNG?

TestNG listeners are used to configure reports and logging. One of the most widely used listeners inTestNG is ITestListener interface. It has methods like on Test Start, on Test Success, on TestFailure, on Test Skipped etc. We should implement this interface creating a listener class of ourown. Next, we should add the listeners annotation (@Listeners) in the Class which was created.

137. What is Selenium and what is composed of?

Selenium is a suite of tools for automated web testing. It is composed of
 Selenium IDE (Integrated Development Environment) : It is a tool for recording and playingback. It is a firefox plugin
 WebDriver and RC: It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works.
 Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites

138.What is Selenium 2.0?

Web Testing tools Selenium RC and WebDriver are consolidated in single tool in Selenium 2.0

139. Mention what is Selenium 3.0?

Update GeckoDriver –port argument in all bindings

140. How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page they are
• ID
• Name
• Tag
• Attribute
• CSS
• Link text
• Partial Link Text
• Xpath etc

141.List out the test types that are supported by Selenium?

For web based application testing selenium can be used
 The test types can be supported are
 a) Functional, Learn More about Functional Testing.
 b) Regression
 For post release validation with continuous integration automation tool could be used
 a) Jenkins
 b) Hudson
 c) Quick Build
 d) Cruise Cont

142. Explain what is assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the state of the application conforms towhat is expected. The types of assertion are “assert” , “verify” and “wait For”.

143.Mention what is the use of X-path?

X-Path is used to find the WebElement in web pages. It is also useful in identifying the dynamic elements. Refer Complete Guide on XPath

144.Explain the difference between single and double slash in X-path?

 Single slash ‘/ ’
 Single slash ( / ) start selection from the document node
 It allows you to create ‘absolute’ path expressions
 Double Slash ‘// ’
 Double slash ( // ) start selection matching anywhere in the document
 It enables to create ‘relative’ path expressions

145.List out the technical challenges with Selenium?

 Selenium supports only web based applications
 It does not support the Bitmap comparison
 For any reporting related capabilities have to depend on third party tools
 No vendor support for tool compared to commercial tools like HP UFT
 As there is no object repository concept in Selenium, maintainability of objects becomes difficult

146. What is the difference between type keys and type commands ?

 Type Keys() will trigger JavaScript event in most of the cases whereas .type() won’t. Type key populates the value attribute using JavaScript whereas .type keys() emulates like actual user typing

147.What is the difference between verify and assert commands?

 Assert: Assert allows to check whether an element is on the page or not. The test will stop on the step failed, if the asserted element is not available. In other words, the test will terminated at the point where check fails.
 Verify: Verify command will check whether the element is on the page, if it is not then the test will carry on executing. In verification, all the commands are going to run guaranteed even if any of test fails.

148.What is JUnit Annotations and what are different types of annotations which are useful ?

 In JAVA a special form of syntactic meta-data can be added to Java source code, this is know as Annotations. Variables, parameters, packages, methods and classes are annotated some of the Junit annotations which can be useful are
 Test
 Before
 After
 Ignore
 Before Class
 After Class
 Run With

149. While using click command can you use screen coordinate?

To click on specific part of element, you would need to use clickAT command. ClickAt command accepts
element locator and x, y co-ordinates as argumentsclickAt (locator, cordString)

150.What are the advantages of Selenium?

 It supports C#, PHP, Java, Perl, Python
 It supports different OS like Windows, Linux and Mac OS
 It has got powerful methods to locate elements (Xpath, DOM , CSS)
 It has highly developer community supported by Google

151.Why testers should opt for Selenium and not QTP?

 Selenium is an open source whereas QTP is a commercial tool
 Selenium is used specially for testing web based applications while QTP can be used for testingclient server application also
 Selenium supports Firefox, IE, Opera, Safari on operating systems like Windows, Mac, Linux etc. however QTP is limited to Internet Explorer on Windows.
 Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script

152. What are the four parameter you have to pass in Selenium?

Host
Port Number
Browser
URL

153.What is the difference between set Speed() and sleep() methods?

Both will delay the speed of execution.
 Thread . sleep () : It will stop the current (java) thread for the specified period of time. Its done only once
 It takes a single argument in integer format
 Ex: thread . sleep(2000)- It will wait for 2 seconds
 It waits only once at the command given at sleep
 Set Speed () : For specific amount of time it will stop the execution for every selenium
command.
 It takes a single argument in integer format
 Ex: selenium . Set Speed(“2000”)- It will wait for 2 seconds
 Runs each command after set Speed delay by the number of milliseconds mentioned in set Speed
 This command is useful for demonstration purpose or if you are using a slow web application

154. What is same origin policy? How you can avoid same origin policy?

The “Same Origin Policy” is introduced for security reason, and it ensures that content of your site will never be accessible by a script from another site. As per the policy, any code loaded within the browser can only operate within that website’s domain.
To avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the
Selenium Server acts as a client configured HTTP proxy , which sits between the browser and application under test and then masks the AUT under a fictional URL

155.What is heightened privileges browsers?

The purpose of heightened privileges is similar to Proxy Injection, allows websites to do
something that are not commonly permitted. The key difference is that the browsers are launced
in a special mode called heightened privileges. By using these browser mode, Selenium core can
open the AUT directly and also read/write its content without passing the whole AUT through the
Selenium RC server.

156.How you can use “submit” a form using Selenium ?

You can use “submit” method on element to submit formElement . submit () ;
Alternatively you can use click method on the element which does form submission

157. What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are
• Support for annotations
• Support for data-driven testing
• Flexible test configuration
• Ability to re-execute failed test cases

158.Mention what is the difference between Implicit wait and Explicit wait?

Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount of time it will try looking for element again and again before throwing a No SuchElement Exception. It waits for elements to show up.

159.Which attribute you should consider throughout the script in frame for “if no frame Id as well as no frame name”?

 You can use…..driver .find Elements(By . xpath(“//if rame”))….
 This will return list of frames.
 You will need to switch to each and every frame and search for locator which we want.
 Then break the loop

160. Explain what is the difference between find elements () and find element () ?

find element ():
 It finds the first element within the current page using the given “locating mechanism”. It returns a single Web Element
 findElements () : Using the given “locating mechanism” find all the elements within the current page. It returns a list of web elements.

161.Explain what are the JUnits annotation linked with Selenium?

The JUnits annotation linked with Selenium are
@Before public void method() – It will perform the method () before each test, this method can prepare the test
@Test public void method() – Annotations @Test identifies that this method is a test method environment
@After public void method()- To execute a method before this annotation is used, test method must start with test@Before

162.Explain how you can login into any site if it’s showing any

authentication popup for password and username?
Syntax-http://username:password@url
ex- http://creyate:[email protected]

163. Explain what is Data driven framework and Keyword driven?

Data driven framework: In this framework, the test data is separated and kept outside the
Test Scripts, while Test Case logic resides in Test Scripts. Test data is read from the external files ( Excel Files) and are loaded into the variables inside the Test Script. Variables are used for both for input values and for verification values.
Key worddriven framework: The keyword driven frameworks requires the development of
data tables and keywords, independent of the test automation. In a keyword driven test, the functionality of the application under test is documented in a table as well as step by step instructions for each test.

164.Explain how you can login into any site if it’s showing any authentication

popup for password and username?
• Syntax-http://username:password@url
• ex- http://creyate:[email protected]

165.What is Object Repository ?

An object repository is an essential entity in any UI automations which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

166.Explain how Selenium Grid works?

Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Web driver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.

167. List the advantages of Web driver over Selenium Server?

If you are using Selenium-Web Driver, you don’t need the Selenium Server as it is using totally different technology
Selenium Server provides Selenium RC functionality which is used for Selenium 1.0 backwards compatibility Selenium Web driver makes direct calls to browser using each browsers native support for automation, while Selenium RC requires selenium server to inject Java script into the browser

168.Mention what are the capabilities of Selenium Web Driver or Selenium 2.0 ?

Handling multiple frames, pop ups , multiple browser windows and alerts
Page navigation and drag & drop Ajax based UI elements Multi browser testing including improved functionality for browser not well supported by Selenium 1.0

169.Explain how you can find broken images in a page using Selenium Web driver ?

• Get XPath and get all the links in the page using tag name
• In the page click on each and every link
• Look for 404/500 in the target page title

170. Explain how you can handle colors in web driver?

To handle colors in web driver you can use
Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument

171.Using web driver how you can store a value which is text box?

 You can use following command to store a value which is text box using web driver
 Driver . Find Element(By.id(“your Textbox”)).send Keys(“your keyword”);

172.Explain how you can switch between frames?

To switch between frames web drivers [ driver . Switch To().frame() ] method takes one of the three possible arguments
• A number: It selects the number by its (zero-based) index
• A name or ID: Select a frame by its name or ID
• Previously found Web Element: Using its previously located Web Element select a frame

173.Explain using Web driver how you can perform double click?

• Syntax- Actions act = new Actions (driver);
• Act .double Click(web element);

174.How will you use Selenium to upload a file?

 You can use “type ” command to type in a file input box of upload file. Then, you have to use “Robot” class in JAVA to make file upload work.

175.Which web driver implementation is fastest?

HTML Unit Driver implementation is fastest, HTML Unit Driver does not execute tests on browser but plain http request, which is far quick than launching a browser and executing tests

176.Explain how you can handle frames using Selenium 2.0?

 To bring control on HTML frame you can use “Switch To” frame method-
 Driver . Switch To().
 frame(“frame Name”);
 To specify a frame you can use index number
 Drive r. switch To().
 frame(“parentFrame.4.frameName”);
 This would bring control on frame named- “frame Name” of the 4th sub frame names “parent Frame”

177. What is the difference between getWindowhandles() and get windo whandle()?

getwindowhandles(): It is used to get the address of all the open browser and its return type is Set<String> getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string

178.Explain how you can switch back from a frame?

To switch back from a frame use method defaultContent()
Syntax-driver . Switch To().defaultContent();

179.List out different types of locators?

Different types of locators are
 By.id()
 By.name()
 By.tagName()
 By.className()
 By.linkText()
 By.partialLinkText()
 By.xpath
 By.cssSelector()

180.What is the command that is used in order to display the values of a variable into the output console or log?

In order to display a constant string, command can be used is echo <constant string>
If order to display the value of a variable you can use command like echo ${variable name>>

181.Explain how you can use recovery scenario with Selenium?

Recovery scenarios depends upon the programming language you use. If you are using Java then you can use exception handling to overcome same. By using “Try Catch Block” within your Selenium Web Driver Java tests

182.How can you prepare customized html report using TestNG in hybrid framework ?

There are three ways
Junit: With the help of ANT
TestNG: Using inbuilt default.html to get the HTML report. Also XST reports from ANT,
Selenium, Testng combinations
Using our own customized reports using XSL jar for converting XML content to HTML

183.From your test script how you can create html test report?

TestNG: Using inbuilt default.html to get the HTML report. Also XLST reports from ANT, Selenium, TestNG combination
JUnit: With the help of ANT
Using our own customized reports using XSL jar for converting XML content to HTML

184.Explain how you can insert a break point in Selenium IDE ?

Select “Toggle break point” by right click on the command in Selenium IDE
Press “B” on the keyboard and select the command in Selenium IDE
Multiple break points can be set in Selenium IDE

185.Explain in Selenium IDE how can you debug the tests?

 Insert a break point from the location from where you want to execute test step by step
 Run the test case
 At the given break point execution will be paused
 To continue with the next statement click on the blue button
 Click on the “Run” button to continue executing all the commands at a time

186.What is Selenese and what are the types of Selenese ?

 Actions: It is used for performing the operations and interactions with the target elements
 Assertions: It is used as a check points
 Accessors: It is used for storing the values in a variable

187.What are the two modes of views in Selenium IDE ?

Either Selenium IDE can be opened as a pop up window or in side bar

188.How you can convert any Selenium IDE tests from Selenese to another language?

You can use the format option of Selenium IDE to convert tests into another programming
language

189.Using Selenium IDE is it possible to get data from a particular html table cell?

 You can use the “store Table” command
 Example store text from cell 0,2 from an html table
 Store Table
 Css=#table 0.2
 textFromCell

190.Explain what can cause a Selenium IDE test to fail?

 When a locator has changed and Selenium IDE cannot locate the element
 When element Selenium IDE waiting to access did not appear on the web page and the
operation timed out
 When element Selenium IDE was trying to access was not created

191.Explain how you can debug the tests in Selenium IDE ?

Insert a break point from the location where you want to execute step by step
Run the test case At the given break point execution will be paused To continues with the next step click on the Blue button To run commands at a time click on run button

192.From Selenium IDE how you can execute a single line?

From Selenium IDE single line command can be executed in two ways
Select “Execute this command” by right clicking on the command in Selenium IDE
Press “X” key on the keyboard after selecting the command in Selenium IDE

193.In which format does source view shows your script in Selenium IDE?

In Selenium IDE source view shows your script in XML format

194.What if you have written your own element locator and how would you test it?

To test the locator one can use “Find Button” of Selenium IDE, as you click on it, you would see on screen an element being highlighted provided your element locator is right or or else an error message will be displayed

195.What is regular expressions? How you can use regular expressions in Selenium?

A regular expression is a special text string used for describing a search pattern. In Selenium IDE regular expression can be used with the keyword- regexp: as a prefix to the value and patterns needs to be included for the expected values.

196.State the major difference between “assert” and “verify” commands in Selenium.

Both “assert” and “verify” commands check whether the given condition is true or false and the only difference between them is that:
 Assert: Assert condition stops the execution of the testing if the given condition is false else would continue with the further tests.
 Verify: Verify the condition doesn’t stop the flow of execution irrespective of the condition being true or false.

197.Demonstrate usage of Selenium through a test application.

 You need the following prerequisites to run a demo Selenium test script:
 Java SDK in your respective Operating System.
 A Java-based IDE such as Eclipse or IntelliJ.
 A Selenium Web Driver to be added as a dependency to Java IDE.

198.What are the advantages of automation testing?

Some basic Advantages of automation testing are as follows.
 Automation testing supports both functional and performance test on an application.
 It supports the execution of repeated test cases.
 It facilitates parallel execution.
 It aids in testing a large test matrix.
 It improves accuracy because there are no chances of human errors.
 It saves time and money.

199.What is Selenium?

Selenium is a portable framework for software testing. Selenium tool facilitates with a playback tool for authoring functional tests without the need to learn a test scripting language.Selenium is one of the most widely used open source Web UI (User Interface) automation testing suite. Jason Huggins developed Selenium in 2004 as an internal tool at Thought Works. Selenium supports automation across different browsers, platforms, and programming languages.

200.What are the significant changes/upgrades in various Selenium versions?

Selenium v1.0:
 Version 1.0 was the initial release of Selenium.
 It included three tools: Selenium IDE, Selenium RC, and Selenium Grid.
Selenium v2.0:
 Selenium Web Driver was introduced replacing Selenium RC in version “2.0”.
 With the onset of Web Driver, RC got deprecated and moved to the legacy package.
Selenium v3:
 The latest release Selenium 3 has new added features and functionalities.
 It includes Selenium IDE, Selenium Web Driver, and Selenium Grid.

 

Join the best course in the best institute

Gautham Digital Learning
Gautham Digital Learning
Gautham Digital Learning is the #1 IT Digital Learning (100% Job Assistance in Career Courses), and We are the best providers of Information Technology skills training. We deliver authentic competency-based programs & ensure to lower your expenses, all at the same time. We are the most Advised IT Digital Learning Center... We are working very sincerely and trained 20000+ students professionally.

Get in Touch

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Articles

Get in Touch

0FansLike
3,912FollowersFollow
0SubscribersSubscribe

Latest Posts