Selenium WebDriver Is A Collection Of Open Source APIs Which Are Used To Automate The Testing Of A Web Application
1.What is Selenium and what is composed of?
Selenium is a suite of tools for automated web testing. It is composed of
a firefox plugin
of the browsers Webdriver and RC works.
which helps in cutting down the time required for running in browser test suites.
2.What is Selenium 2.0 ?
Web testing tools Selenium RC and WebDriver are consolidated in single tool in Selenium 2.0
3.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 findan element in a web page they are
4.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
b) Regression
For post release validation with continuous integration automation tool could be used
a) Jenkins
b) Hudson
c) Quick Build
d) CruiseCont
5.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 to what isexpected. The types of assertion are “assert” , “verify” and “waifFor”.
6.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.
7.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
8.List out the technical challenges with Selenium?
Technical challenges with Selenium are
9.What is the difference between type keys and type commands ?
TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won’t. Type key populatesthe value attribute using JavaScript whereas .typekeys() emulates like actual user typing
10.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 stepfailed, if the asserted element is not available. In other words, the test will terminated at the point wherecheck fails.
Verify: Verify command will check whether the element is on the page, if it is not then the test will carryon executing. In verification, all the commands are going to run guaranteed even if any of test fails.
11.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 asAnnotations. Variables, parameters, packages, methods and classes are annotated some of the JUnitannotations which can be useful are
12.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 acceptselement locator and x, y co-ordinates as arguments- clickAt (locator, cordString).
13.What are the advantages of Selenium?
14.Why testers should opt for Selenium and not QTP?
Selenium is more popular than QTP as
server application also
QTP is limited to Internet Explorer on Windows.
script.
15.What are the four parameter you have to pass in Selenium?
Four parameters that you have to pass in Selenium are
16.What is the difference between setSpeed() 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
SetSpeed () : For specific amount of time it will stop the execution for every selenium command.
Ex: selenium.setSpeed(“2000”)- It will wait for 2 seconds
Runs each command after setSpeed 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
17.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 willnever be accessible by a script from another site. As per the policy, any code loaded within the browser canonly operate within that website’s domain.
To avoid "Same Origin Policy" proxy injection method is used, in proxy injection mode the SeleniumServer acts as a client configured HTTP proxy , which sits between the browser and application under testand then masks the AUT under a fictional URL
18.What is heightened privileges browsers?
The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something thatare not commonly permitted. The key difference is that the browsers are launched in a special mode calledheightened privileges. By using these browser mode, Selenium core can open the AUT directly and alsoread/write its content without passing the whole AUT through the Selenium RC server.
19.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
20.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, fromunit testing to integration testing. And the functionality which makes it efficient testing framework are
21.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 itwill try looking for element again and again before throwing a
NoSuchElementException. It waits for elements to show up.
Explicit Wait : It is a one-timer, used for a particular search.
22.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.findElements(By.xpath(“//iframe”))….
This will return list of frames.
You will ned to switch to each and every frame and search for locator which we want.
Then break the loop
23.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 singleWebElement
findElements () : Using the given "locating mechanism" find all the elements within the current page. Itreturns a list of web elements.
24.Explain what are the JUnits annotation linked with Selenium?
The JUnits annotation linked with Selenium are
test
with test@Before
25.Explain what is Datadriven framework and Keyword driven?
Datadriven 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 areloaded into the variables inside the Test Script. Variables are used for both for input values and forverification values.
Keyworddriven framework: The keyword driven frameworks requires the development of data tablesand keywords, independent of the test automation. In a keyword driven test, the functionality of theapplication under test is documented in a table as well as step by step instructions for each test.
26.Explain how you can login into any site if it’s showing any authentication popup for password and username?
Pass the username and password with url
Syntax-http://username:password@url
ex- http://creyate:tom@www.gmail.com
27.Explain how to assert text of webpage using selenium 2.0 ?
WebElement el = driver.findElement(By.id("ElementID"))
//get test from element and stored in text variable
String text = el.getText();
//assert text from expected
Assert.assertEquals("Element Text", text);
28.What is Object Repository ?
An object repository is an essential entity in any UI automations which allows a tester to store all objectthat will be used in the scripts in one or more centralized locations rather than scattered all over the testscripts.
29.Explain how Selenium Grid works?
Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launchthe browser and run the test. With entire test suite, it allows for running tests in parallel.
30.Can we use Selenium grid for performance testing?
Yes. But not as effectively as a dedicated performance testing tool like Loadrunner.
31.How to developer Selenium Test Cases?
Using the Selenium IDE, QA Tester can record a test to comprehend the syntax of Selenium IDEcommands, or to check the basic syntax for a specific type of user interface. Keep in mind that SeleniumIDE recorder is not clever as QA Testers want it to be. Quality assurance team should never considerSelenium IDE as a "record, save, and run it" tool, all the time anticipate reworking a recorded test cases tomake them maintainable in the future.
32.What are the limitations of Selenium IDE?
Selenium IDE has many great features and is a fruitful and well-organized test automation tool fordeveloping test cases, in the same time Selenium IDE is missing certain vital features of a testing tool:conditional statements, loops, logging functionality, exception handling, reporting functionality, databasetesting, re-execution of failed tests and screenshots taking capability. Selenium IDE doesn't for IE, Safariand Opera browsers.
33.What programming language is best for writing Selenium tests?
The web applications may be written in Java, Ruby, PHP, Python or any other web framework. There arecertain advantages for using the same language for writing test cases as application under test. Forexample, if the team already have the experience with Java, QA Tester could always get the piece ofadvice while mastering Selenium test cases in Java. Sometimes it is better to choose simpler programminglanguage that will ultimately deliver better success. In this case QA testers can adopt easier programminglanguages, for example Ruby, much faster comparing with Java, and can become become experts as soonas possible.
34.What are the advantage and features of Selenium IDE?
a. Intelligent field selection will use IDs, names, or XPath as neededb. It is a record & playback tool and the script format can be written in various languages including C#,Java, PERL, Python, PHP, HTMLc. Auto complete for all common Selenium commandsd. Debug and set breakpointse. Option to automatically assert the title of every pagef. Support for Selenium user-extensions.js file
35.How to debug the tests in Selenium IDE?
To debug or execute the test cases line by line. Follow the below mentioned steps1. Insert a break point (see the question to know more How to insert a break point in Selenium IDE? )fromthe location where you want to execute step by step2. Run the test case3. execution will be paused at the given break point4. Click on the step (Blue) button to continue with the next statement5. Click on Run button, to continue executing all the commands at a time.
36.How to insert a start point in Selenium IDE?
Start point Selenium IDE can be set in two ways:1. Right click on the command in Selenium IDE and select "Set / Clear Start Point"2. Select the command in Selenium IDE and press "S" key on the keyboard3. You can have only one start point4. If you have already set one start point and you selected other command as start point. Then the first startpoint will be removed and the new start point will be set.
37.What are the capabilities of Selenium IDE?
Selenium IDE (Integrated Development Environment) works similar to commercial tools like QTP, SilkTest and Test Partner etc.The below mentioned points describes well about Selenium IDE.1. Selenium IDE is a Firefox add-on.2. Selenium IDE can support recording the clicks, typing, and other actions to make a test cases.3. Using Selenium IDE A Tester can play back the test cases in the Firefox browser4. Selenium IDE supports exporting the test cases and suites to Selenium RC.5. Debugging of the test cases with step-by-step can be done6. breakpoint insertion is possible
7. Page abstraction functionality is supported by Selenium IDE
8. Selenium IDE can supports an extensibility capability allowing the use of add-ons or user extensions thatexpand the functionality of Selenium IDE.
38.What are the test types supported by Selenium?
Selenium could be used for testing the web based applications. The test types can be supported are:
1. functional,
2. regression,
3. load testing
39.What is Selenium RC (Remote Control)?
Selenium RC allows the test automation expert to use a programming language for maximum flexibilityand extensibility in developing test logic. For example, if the application under test returns a result set andthe automated test program needs to run tests on each element in the result set, the iteration / loop supportof programming language’s can be used to iterate through the result set, calling Selenium commands to runtests on each item. Selenium RC provides an API and library for each of its supported languages. Thisability to use Selenium RC with a high level programming language to develop test cases also allows theautomated testing to be integrated with the project’s automated build environment.