1) What is test automation or automation testing?
Automation testing is used to automate the manual testing. It is a process of automating the manual process to test the application/system under test. It uses separate testing tools which facilitate you to create test scripts which can be executed repeatedly and doesn’t need any manual intervention.
2) What are the advantages of automation testing?
- It supports 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.
3) What is selenium? What are the different components of selenium?
Selenium is one of the most popular automated testing suites. It is browser automation tool which lets you automated operations like click, type and selection from a drop down of a web page. It is designed to support and encourage automation testing of functionalities of web based applications and a wide range of browsers and platforms. It is one of the most accepted tools amongst the testing professional due to its existence in the open source community.
Selenium is not just a single tool rather than it is a package of several testing tools and that?s why it is referred as a suite. Each of these tools is designed to cater different testing and test environment requirement.
4) What is Selenium 1.0?
Selenium 1.0 is popularily known as Selenium Remote Control (Selenium RC). It is a library available in wide variety of languages. The main reason to use Selenium RC was that Selenium IDE was incapable to execute tests in browsers other than Selenium IDE and the limitation of language Selenese used in Selenium IDE.
5) What is Selenium IDE?
Selenium IDE is a firefox plug-in. It is used to record and replay tests in firefox browser. It is used only with firefox browser.
6) What is selenium 2.0?
Selenium 2.0 is a tool which is a combination of web testing tools Selenium RC and WebDriver.
7) Why is selenium selected as a test tool?
Selenium is used as a testing tool because:
- It is free and open source.
- It has a large user base and helping communities.
- Compatible on different platforms i.e. Windows, Mac OS, Linux etc.
- Have cross browser compatibility (Chrome, Firefox, IE, Safari etc.)
- Support multiple programming languages ( Java, C#, Ruby, PERL, Python etc.)
- Support distributed testing.
8) What are selenium supporting testing types?
Selenium supports two types of testing:
- Functional Testing
- Regression Testing
9) What are the limitations of selenium?
Selenium has following limitations:
- It can be used only to test web based application.
- Mobile applications can not be tested using selenium.
- You can not test captcha and bar code by using selenium.
- The user must have the knowledge of programming language for using selenium.
- Reports can only be generated using third party tools like TestNG or Junit.
10) What is selenese?
Selenese is a lanuage which is used for writing test script in selenium IDE.
11) Describe the different types of locators in Selenium?
Locator is an address which identifies a web element uniquely within the web page.
There are different types of locators in Selenium to identify web elements accurately and precisely.
- CSS Selector
12) What is an Xpath?
Xpath is used to locate a web element based on its XML path. It can be used to locate HTML elements.
13) Which is the latest Selenium tool?
The latest Selenium tool is WebDriver.
14) What are the different types of Drivers that WebDriver contains?
These are the different drivers available in WebDriver:
15) What are the different types of annotations which are used in Selenium?
JUnit annotations which can be used are:
16) What is Selenium Grid?
Selenium Grid facilitates you to distribute your tests on multiple machines and all of them at the same time. So, you can execute tests on Internet Explorer on Windows and Safari on Mac machine using the same text script. It reduces the time of test execution and provides quick feedback.
17) Where the result is seen of Test Execution in Selenium IDE?
The result of test execution is displayed in a Log Window in Selenium IDE.
18) Can you edit tests in Selenium IDE?
Yes, tests in Selenium IDE can be edited. There are two ways to edit tests in Selenium IDE.
- By Table views
- Looking into the source code
19) Can you use html id and name while using Selenium IDE?
Yes, You can use html id and name as it is available in Selenium IDE.
20) What are the WebDriver supported Mobile Testing Drivers?
WebDriver supported “mobile testing drivers” are:
21) What are the popular programming languages supported by Selenium WebDriver to write Test Cases?
22) What is the difference between assert and verify commands?
Assert: Assert command checks if the given condition is true or false. If the condition is true, the program control will execute the next phase of testing, and if the condition is false, execution will stop and nothing will be executed.
Verify: Verify command also checks if the given condition is true or false. It doesn’t halts program execution i.e. any failure during verification would not stop the execution and all the test phases would be executed.
23) What is the difference between “/” and “//” in Xpath?
Single Slash “/”: Single slash is used to create Xpath with absolute path.
Double Slash “//”: Double slash is used to create Xpath with relative path.
24) What is the difference between driver.get() and driver.navigate.to()
Both methods can be used to navigate to a url but the driver.get() is a convenient way to navigate to a url. The driver.navigate() does the same function as the driver.navigate().to(?url?) but it also has other functions, such as:
25) What is the difference between implicit wait and explicit wait in selenium webdriver?
Implicit Wait: In Implicit wait, if WebDriver cannot find an element in the Document Object Model (DOM), it will wait for a defined amount of time for the element to appear in the DOM. The Implicit wait may slow down your tests, because once set, the implicit wait is set for the life of the WebDriver object’s instance.
An example of Implicit Wait:
- driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Explicit waits are better than implicit wait. Unlike an implicit wait, you can write custom code or conditions for wait before proceeding further in the code.
An explicit wait can be used where synchronization is needed, for example the page is loaded but we are still waiting for a call to complete and an element to appear.
An example of Implicit Wait:
- WebDriverWait wait = new WebDriverWait(driver, 10);
26) What is the difference between type keys and type commands?
27) What is the difference between “type” and “typeAndWait” command?
“type” command is used to type keyboard key values into text box of software web application. It can also be used for selecting values of combo box whereas “typeAndWait” command is used when your typing is completed and software web page start reloading. This command will wait for software application page to reload. If there is not page reload event on typing, you have to use simple “type” command.
28) What is the difference between sleep() and setSleep() method?
Sleep() and setSleep() both methods are used to delay the speed of execution.
Thread.sleep (): It is used to stop the current (java) thread for the specified period of time. It’s done only once.
- It takes a single argument in integer format.
- For Example: thread.sleep(5000)- It will wait for 5 seconds.
- It waits only once at the command given at sleep.
SetSpeed (): It will stop the execution for every selenium command for specific amount of time.
- It takes a single argument in integer format.
- For Example: selenium.setSpeed(“5000”)- It will wait for 5 seconds.
- It runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed.
29) What is the difference between find element () and findElements ()?
find element (): It is used to find the first element within the current page using the given “locating mechanism”. It returns a single WebElement.
findElements () : It uses the given “locating mechanism” to find all the elements within the current page. It returns a list of web elements.
30) How to type in a text box using Selenium?
To type in a text box, we use sendKeys(“String to be entered”) to insert string in the text box.
- WebElement username = drv.findElement(By.id(“Email”));
- // entering username
31) What is JUnit?
JUnit is an open source testing framework for java applications. It is introduced by Apache.
32) What is JUnit Annotation?
Annotation is a process of adding a special form of syntactic meta-data to Java source code. Variables, parameters, packages, methods and classes are annotated some of the JUnit annotations.
33) What are the four parameters that you need to pass in Selenium?
The four parameters that you have to pass in Selenium are:
- Port Number
34) How can you “submit” a form using Selenium ?
- WebElement el = driver.findElement(By.id(“ElementID”));
35) What is the difference between close() and quit()?
The close() method closes the current browser only whereas quit() method closes all browsers opened by WebDriver.
36) What is wait? How many types of waits in selenium?
The concept of waits is introduced by Selenium Webdriver for AJAX based application. There are two types of waits:
- Implicit Wait
- Explicit Wait
37) What is the main disadvantage of implicit wait?
The main disadvantage of implicit wait is that it slows down test performance.
Another disadvantage of implicit wait is:
Suppose, you set the waiting limit to be 10 seconds and the elements appears in the DOM in 11 seconds, your tests will be failed because you told it to wait a maximum of 10 seconds.
38) How would you check if a check-box or radio button is selected?
You can use the isSelected() method to check if a check-box or radio button is selected.
39) How would you do drag and drop in Selenium Webdriver?
You can do drag and drop in Selenium by using the following code:
- Actions action = new Actions(driver);
- WebElement start = driver.findElement(By.cssSelector(?div.source?));
- WebElement end = driver.findElement(By.cssSelector(?div.target?));
40) How would you check if an element is visible on the page?
isDisplayed() method is used to check if an element is visible on the page. The return type of this method is Boolean so, if it returns true, the element is visible otherwise it is not.
41) How would you check if a button is enabled on a page?
isEnabled() method is used to check if a button is enabled on a page. The return type of this method is Boolean so, if it returns true, the element is visible otherwise it is not.
42) What are the main technical problems occurred with Selenium tools?
Like other automation testing tools, selenium also facilitates you to record, edit and debug test cases. But there are some problems that affect the maintainability of recorded test cases. Sometimes it takes more time to maintain automated test cases than to perform manual testing. Another problem is complex id for an HTML element. If ID is auto generated, the recorder test cases can fail during playback.
43) Which is the post release validation with continuous integration automation tool?
These tools are:
- Quick Build
44) What are the four parameters that have to be passed in Selenium?
Four parameters that have to be passed in selenium are:
- Port Number