Selenium WebDriver
List out the technical challenges with Selenium
Allows only web based applications, not support the Bitmap comparison, reporting not supported, No vendor support, no object repository concepts like HP UFT
What is Object Repository
An object repository is an essential entity in any UI automations which allows a tester to store all object in centralize location
difference between verify and assert commands
Assert allows to check whether an element is on the page or not - pass or failed - edit test Verify command will check whether the element is on the page In verification, all the commands are going to run guaranteed even if any of test fails.
For Database Testing in Selenium Webdriver what API is required?
For Database Testing in Selenium Webdriver, you need JDBC (Java Database Connectivity) API. It allows you to execute SQL statements.
how you can find broken images in a page
Get XPath and get all the links in the page using tag name then click each link in list and Look for 404/500 in the target page title
capabilities of Selenium WebDriver
Handling multiple frames, pop ups , multiple browser windows and alerts Page navigation and drag & drop Ajax based UI elements Multi browser testing
four parameter you have to pass in Selenium
Host, Port Number, Browser, URL
Mention what are the types of Listeners in TestNG?
IAnnotationTransformer IAnnotationTransformer2 IConfigurable IConfigurationListener IExecutionListener IHookable IInvokedMethodListener IInvokedMethodListener2 IMethodInterceptor IReporter ISuiteListener ITestListener
what is the difference between Implicit wait and Explicit wait
Implicit Wait: Sets a timeout for all successive Web Element searches Explicit Wait : It is a one-timer, used for a particular search.
customized html report using TestNG in hybrid framework
Impliment ANT or XSLT reports
Mention what is Listeners in Selenium WebDrive
In Selenium WebDriver, Listeners "listen" to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners
in order to display the values of a variable into the output console
In order to display a constant string ---,System.out.println()
Mention what is desired capability? How is it useful in terms of Selenium
It can be used to configure the driver instance of Selenium WebDriver. When you want to run the test cases on a different browser with different operating systems and versions.
advantages of Selenium
Language support, OS support, dom locator support and opensource community support
how to login into site with authentication popup for username / Password?
Pass the username and password with url Syntax-http://username:password@url ex- http://creyate:[email protected]
Mention when to use AutoIT?
Selenium is designed to automate web-based applications on different browsers. But to handle window GUI and non-HTML popups in the application you need AutoIT. know more about How to use AutoIT with Selenium
single and double slash in X-path
Single slash ( / ) start selection from the document node ( create 'absolute' path expressions) Double slash ( // ) start selection matching anywhere in the document.create 'relative' path expressions
difference between setSpeed() and sleep() methods
Sleep will stop the current (java) thread for the specified period of time SetSpeed For specific amount of time it will stop the execution for every selenium command
features of TestNG
Support for annotations Support for data-driven testing Flexible test configuration Ability to re-execute failed test cases
To generate pdf reports mention what Java API is required?
To generate pdf reports, you need Java API IText
iterate through options in test script
To iterate through options for different test data in a text box you can use "for" loop in Java
how you can switch back from a frame
To switch back from a frame use method defaultContent()
how you can switch between frames
To switch between frames webdrivers [ driver.switchTo().frame() ]A number or ID: Select a frame by its name or ID
how you can handle colors
Use getCssValue(arg0) function to get the colors by sending 'color' string as an argument
what are the challenges in Handling Ajax Call in Selenium Webdriver
Using "pause" command for handling Ajax call Long pause time makes the test unacceptably slow and increases the testing time.
what ways you can customize TestNG report
Using ITestListener Interface Using IReporter Interface
How will you handle working with multiple windows
We can use the command selectWindow to switch between windows. This command uses the title of Windows to identify which window to switch to.
Webdriver how you can perform double click
You can perform double click by using Syntax- Actions act = new Actions (driver); act.doubleClick(webelement);
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.
How can you retrive the message in an alert box
You can use the storeAlert command which will fetch the message of the alert pop up and store it in a variable.
How will you verify the specific position of an web element
You can use verifyElementPositionLeft & verifyElementPositionTop. It does a pixel comparison of the position of the element from the Left and Top of page respectively
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"))...
What is same origin policy? How you can avoid same origin policy?
any code loaded within the browser can only operate within that website's domain. By using proxy setup or proxy injection mode the Selenium Server acts as a client configured HTTP proxy
how you can create html test report
default.html to get the HTML report. Also XLST reports from ANT
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, Linktext, PartialLink, Text, Xpath etc
difference between find elements () and find element ()
It finds the first element within the current page using the given "locating mechanism". It returns a single WebElement findElements () : Using the given "locating mechanism" find all the elements within the current page. It returns a list of web elements.
Mention why do you need Session Handling while working with Selenium
during test execution, the Selenium WebDriver has to interact with the browser all the time to execute given commands. At the time of execution, it is also possible that, before current execution completes, someone else starts execution of another script, in the same machine and in the same type of browser. So to avoid such situation you need Session Handling.
How do you identify an object using selenium
isElementPresent(String locator)
In Selenium what are Breakpoints and Startpoints
Breakpoints: When you implement a breakpoint in your code, the execution will stop right there. This helps you to verify that your code is working as expected. StartpointsStartpoint indicates the point from where the execution should begin. Startpoint can be used when you want to run the testscript from the middle of the code or a breakpoint.
what is Datadriven framework
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 are loaded into the variables inside the Test Script. Variables are used for both for input values and for verification values.
What are core extension
If you want to "extend" the defualt functionality provided by Selenium Function Library , you can create a Core Extension. They are also called "User Extension".
What is selenium Webdriver
It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver
What is Keyword Driven framework
Keyworddriven 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.
Mention what are the advantages of Using Git Hub For Selenium
Multiple people when they work on the same project they can update project details and inform other team members simultaneously. Jenkins can help you to build the project from the remote repository regularly. This helps you to keep track of failed builds.
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
List out the test types that are supported by Selenium
WebApp - Functional, regression, CI Can be Implimented - Jenkins, Hudson, Quick Build, CruiseCont
Selenium Exemptions
WebDriverException , NoAlertPresentException NoSuchWindowException NoSuchElementException TimeoutException
how to assert text of webpage
WebElement el = driver.findElement(By.id("ElementID")) String text = el.getText(); Assert.assertEquals("Element Text", text);
difference between getWindowhandles() and getwindowhandle()
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
use "submit" a form using Selenium
ou can use "submit" method on element to submit form
use recovery scenario with Selenium
Try catch block
what is the use of X-path
is used to find the WebElement in web pages Finds dynamic elements
List out different types of locators
By.id() By.name() By.tagName() By.className() By.linkText() By.partialLinkText() By.xpath By.cssSelector()
While using click command can you use screen coordinate
ClickAt command accepts element locator and x, y co-ordinates as arguments
how you can handle frames
To bring control on HTML frame you can use "SwitchTo" frame method-
difference between type keys and type commands
TypeKeys() will trigger JavaScript event in most of the cases and type wont Type key populates the value attribute using JavaScript whereas .typekeys() emulates like actual user typing
assertion in Selenium and what are the types of assertion
used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are "assert" , "verify" and "waifFor".