0% found this document useful (0 votes)
17 views8 pages

ans

The document provides an overview of automation testing, specifically focusing on Selenium, its benefits, and various functionalities. It discusses the tools, techniques, and methods used in Selenium, including handling authentication pop-ups, differences between ChromeOptions and DesiredCapabilities, and the importance of assertions. Additionally, it covers database automation testing and the concept of data-driven frameworks in Selenium.

Uploaded by

qavasutesting
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

ans

The document provides an overview of automation testing, specifically focusing on Selenium, its benefits, and various functionalities. It discusses the tools, techniques, and methods used in Selenium, including handling authentication pop-ups, differences between ChromeOptions and DesiredCapabilities, and the importance of assertions. Additionally, it covers database automation testing and the concept of data-driven frameworks in Selenium.

Uploaded by

qavasutesting
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Q1). What do you mean by automation testing or test automation?

Automation testing automates the manual testing process which facilitates the creation of multiple testing
scripts that can be executed repeatedly without any manual intervention.

Q2). Are there any benefits of automation testing over manual testing?
The advantages of automation testing are just the endless. Here we have discussed on some of the major
benefits that are usually experienced by testing professionals during the entire process –

 Automation testing is more accurate and less prone to human errors.


 It is faster and budget solution tool
 It helps in testing large modules in the limited time span.
 It allows facility of parallel execution whenever needed.

Q3). Selenium is a single testing tool, then why it is taken as a suite by professionals?
The tools available to work with selenium are specially designed to cater to different testing requirements
so it is taken as a testing package not only a single tool.

Q4). What are selenium supporting testing types?


Selenium tool supports two types of testing – Functional testing and Regression testing.

Q5). Are there any drawbacks of selenium testing tool?


The functionality of the selenium testing tool is limited to web applications only. It cannot be used mobile
apps or API testing. Further, selenium tool does not provide a facility to test Captcha and barcodes. You
must have knowledge of some programming language when working on selenium. For report generation,
you have to use third-party tools.

Q6). What do you understand by the term “Selenese”?


Selenese is a popular programming language that is used to write test scripts in Selenium IDE.

Q7). How to identify web elements in Selenium?


To identify web elements in Selenium, you need to work with locators. They are the address identifiers to
identify web elements accurately and more precisely. The most popular locators in Selenium include ID,
TagName, CSS Selector, DOM, ClassName, LinkTest, Name, XPath and many others.

Q8). Explain the meaning of XPath in Selenium?


Based on the XML path of web elements, XPath is used to locate elements on web page. In other words, it
is popular to locate HTML elements on a webpage.

Q9). How to count a number of elements on a page?


To count a number of elements on a page, you first need to locate them and count the final size for the
page.

Q10). Can you name the popular selenium tool used by large industries worldwide?
Selenium Web Driver is a popular testing tool used by big Companies today.
Q11). Explain about the waiting methods in selenium Web Driver?
The two popular waiting methods in selenium Web Driver are – implicit wait an explicit wait. Implicit
waiting method is used when Web Driver is not able to find elements in the document, then it waits for the
certain time period for the element to appear in the document.

At the same time, the explicit waiting method is an advanced technique that allows developers to write
custom codes whenever required.

Q12). Where the implicit waiting method and explicit it waiting method can be used in
your script?
Implicit waiting method is time-consuming but suitable for all types of elements, but the explicit wait time
is used for selected elements only.

Q13). Is there any technique to check either button is enabled on the page or not?
For this purpose, you need to use the Enabled() method in your script. The return value of the method
would be a Boolean. If the return value is true, then the button will be enabled otherwise it will not.

Q14). Is there any technique to check either particular element is visible on the page or
not?
For this purpose, you need to use the is Displayed() method in your script. The return value from the
method would be Boolean. If the return value is true then the element will be visualized otherwise it will
not.

Q15). Name the different type of drivers available in WebDriver?


These are Chrome, Firefox, Safari, Internet Explorer, iPhone, Android, HTML Unit, and Opera Drivers
etc.

Q16). Name the different type of mobile testing drivers supported in WebDriver?
These are iPhone, Android, and Opera Mobile Drivers etc.

Q17). Name the programming languages that are used by Web Driver to write the test
cases?
These are PHP, Python, Ruby, C#, PERL, Java etc.

Q18). Do you know the difference between assert commands and verifying commands in
Selenium WebDriver?
Assert command and verify commands both will check the conditions for Booleans values. In case the
condition is false then assert command will halt the program but verify command does not halt the
program but it takes it to the next phase of execution.

Q19). Explain the difference between"/" and "//"in XPathSelenium Web Driver?
As we have discussed already based on XML path of web elements, XPath is used to locate elements on
web page. Like UNIX, Linux, or any other programming language, single slash ("/") represents absolute
path while double slash ("//") in XPath represents an arelative path.

Q20). Name the different type of annotations used in Selenium WebDriver?


The popular annotations used in Selenium WebDriver include After, Before, Test, Ignore, AfterClass,
BeforeClass, and RunWith etc.
Selenium Tricky Interview Questions and Answers

Q21). Which selenium technology is useful for distributed data processing?


Selenium Grid is a popular technology used for distributed data process that distributes tests on multiple
machines in parallel. In other, tests can be executed in parallel on different operating systems, different
web browsers at the same time by using single script only. Distributed data processing in Selenium not
only reduces overall execution time and feedback is also quick.

Q22). How will you check result of text execution in Selenium IDE?
The result for text execution in selenium IDE is displayed in Log Window.

Q23). How can you modify test cases in Selenium IDE?


Obviously, test cases can be modified in Selenium IDE by table views or by looking up the source code.

Q24). Explain the significance of JUnit in Selenium testing tool?


JUnit is an open source framework introduced by Apache to test Java application.

Q25). How to add meta-data in JUnit selenium testing tool?


JUnit Annotations is a special process to add syntactic meta-data to Java code. Some of the popular
examples of JUnit annotations include variables, parameters, classes, or methods etc.

Q26). How will you explain the difference between quit () and close () methods in
Selenium?
Quit() method ends all the browsers running in Web Driver while close() method ends the current browser
only.

Q27). Why was the concept of waiting method introduced in Selenium? Name the type
of waits in Selenium?
The waiting methods were specially introduced for AJAX based apps in Selenium WebDriver. The two
popular types of waits in Selenium are names as Implicit waits and Explicit waits.

Q28). Is there any drawback of implementing implicit waits in Selenium?


The major drawback of implementing implicit waits in Selenium is exceeded time limits. It slows down the
overall performance of test cases.

Q29). Why Selenium tools fail sometimes?


Selenium testing is slow as compared to other automated testing tools. Another major problem in complex
ID generation where auto-generated ID can result in test case failure during playback.

Q30). Name the four parameters that have to be passed in Selenium?


These parameters are an aPort number, Host, URL, and Browser etc.
1. How to handle an Authentication Pop-up
using Selenium WebDriver?

As IT is rapidly changing, likewise, applications must be more secure. So, many


companies have their own proxy settings for applications. If you open their server in a
browser, it will ask you to enter the credentials. Even Selenium needs to handle the same
auth pop-up before accessing the server.

Here are 3 ways how you can do that.

– Via the URL

Here, one is passing the username and password via the URL.
The syntax is: http://username:password@URL
For example,

Username: rohit
Password: P@ssword
URL: www.myurl.com

String URL = “http://” + rohit + ”:” + P@ssword + “@” + www.myurl.com;


driver.get(URL);
Alert alert = driver.switchTo().alert();
alert.accept();

– Using AutoIT

Sample AutoIT script,

WinWaitActivate(“Authentication Required”,””)
Send(“rohit{TAB}P@ssword{ENTER}”)

The AutoIT script would be passed within the Java code

– With Alerts
One can handle auth pop-ups with alerts with,
driver.switchTo().alert();

//WebDriver Java Code for entering Username and Password

driver.findElement(By.id(“userID”)).sendKeys(“userName”);
driver.findElement(By.id(“password”)).sendKeys(“myPassword”);
driver.switchTo().alert().accept();
driver.switchTo().defaultContent();

In case passing by URL does not work, one can also obtain credentials by Chrome
extensions and driver.
2. The Selenium script runs in Chrome but not
in IE. What can be done?

HTML DOM rendering and CSSOM construction differs from one browser to the next. So,
there may be multiple reasons for a script not working on IE. One can attempt to
troubleshoot the problem by:

1. Using the updated Selenium IE Driver


2. Verifying that the IE driver and working environment are compatible
3. Configuring the IE driver with the setProperty method and by importing dependencies
4. Setting the same value for the ‘Enable Protected Mode’ option for all zones from the
Security tab
5. Turning off the internet security settings in IE when running the script
6.Using CSS Selectors to minimise exceptions
7. Setting a registry entry
8. Avoiding declaring the driver instance as static for running scripts on browsers
parallelly
9. Using the latest Selenium jars
10. Enabling Javascript on the IE browser
11. Using JavaScriptExecutor instead of native click when clicking elements

3. What is the difference between


ChromeOptions and DesiredCapabilities?
ChromeOptions is a class that can be used to manipulate capabilities specific to
ChromeDriver. For instance, you can disable Chrome extensions with:

ChromeOptions options = new ChromeOptions()


options.addArgument(“disable-extensions”);
ChromeDriver driver = new ChromeDriver(options);

DesiredCapabilities can also be used to manipulate a ChromeDriver session. To change


individual web driver properties, DesiredCapabilities class provides key-value pairs.

But, ChromeOptions supports limited clients whereas DesiredCapabilities supports a vast


number of clients. ChromeOptions is supported by Java and other languages.
DesiredCapabilities is available in Java, but its use is deprecated. When working with a
client library, like Selenium Ruby Client, the ChromeOption class will not be available and
DesiredCapabilities will have to be used.

DesiredCapabilities are commonly used with Selenium Grid, for parallel execution of test
cases on different browsers. However, one can use both DesiredCapabilities and
ChromeOptions using merge:

DesiredCapabilities capabilities = new DesiredCapabilities();


options = new ChromeOptions();
options.merge(capabilities);
driver = new ChromeDriver(options);
4. Is it possible to do responsive web design
testing using Selenium?
Responsive web design testing is important, since many users use smartphones or tabs,
and not just laptops, to access applications. Manually testing the application across all
the platforms would entail a cumbersome and time-consuming task, which could
potentially delay releases. To automate RWD testing one can use the Galen Framework.
This add-on runs in Selenium Grid and with it one can run parallel tests as well as have
the tests run in a cloud.

For visual validations, one can do RWD testing with Ocular library. Similarly, WAVE
Evaluator can be used for check compliance with accessibility standards automatically.

5. What is the need of database automation


testing? Is it possible to perform database
testing with Selenium?
Currently, the amount of data being generated and used is increasing by the day.
Moreover, with advanced front ends, back ends need to be more robust and detailed.
Databases play a major role in storing and sequencing data.

– Defect-free data processing


– ACID properties validation (ACID means Atomicity, Consistency, Isolation and
Durability)
– Accurate storage and retrieval of values in and from the database
– Data integrity and proper data mapping
– Bugs that cannot be found in front-end testing are brought to light

Yes, it’s possible to do database testing with Selenium. First you need to make a
connection between the server and the database. To do so you need a JDBC connection.
JDBC is an SQL-based Java API that allows for connectivity between the Java
programming language and various databases. With JDBC it is possible to connect with
the database and execute queries. Once these two steps are done, one can process the
results. Key components of JDBC are:

1. Driver manager
2. Driver
3. Connection

The syntax to connect with the database is:

DriverManager.getConnection(URL, “userid”, “password” )

Similarly, the code to load the JDBC driver is:

Class.forName(“com.mysql.jdbc.Driver”);
To send queries to the database one can use the Statement object. Similarly, to process
the data one can use a getXXX() method.

6. Why are assertions important in Selenium?


What are different types of assertions?
Assertions are important for validation. They clearly state whether or not a test case is
behaving as expected. As a regression suite or sanity suite, for instance, runs for a long
duration, it is not always possible to sit in front of the system and look at the execution.
Assertions help testers mark test cases as passed or failed.

There are 2 types of assertions:

1. Soft assert
This type of assertion will just verify the condition and give the result, but it won’t abort
the test case execution when the test case fails.

2. Hard Assert
This type of assertion checks for the expected result, and if the condition fails to match,
it will abort execution and throw the “java.lang.AssertionError” exception.

The different types of hard assertions in Selenium are:

assertEquals()
assertNotEquals()
assertNull()
assertNotNull()
assertTrue()
assertFalse()

7. What is a data-driven framework? How does


dataProvider help in data driven testing?
Data driven framework is a test automation framework in which the data feed for the test
cases can take the form of databases, tables, or spreadsheets, as in the case of xlsx, xls,
and csv files. With a single automation script, one can run tests for all the test data
available in the files as the data sets are now separate from the test cases.

The @dataProvider annotation in TestNG, a testing framework, helps testers automate


test cases and thereby achieve data-driven testing.

The annotation is:

@DataProvider(name= “searchProvider”)

The return type of the @dataProvider annotation is a 2D array. So, if the array is 3*4
objects, there will be 3 test cases, each having 4 parameters.

You might also like