301) 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

302) What are the Selenese Commands in Selenium ?


  • clicking a link - click or clickAndWait commands
  • entering values - type command
  • selecting options from a drop-down listbox - select command
  • clicking checkboxes or radio buttons - click command

303) What is Test Runner ?

Test Runner allows you to run the test case in a browser loaded with the Selenium-Core Test Runner. Test runner is invoked by clicking the below Shown button in the IDE.

304) 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.

305) 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

306)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

307) What are the four parameter you have to pass in Selenium?

Four parameters that you have to pass in Selenium are

  • Host
  • Port Number
  • Browser
  • URL

308) In Selenium what are the four parameters you have to pass?

Host, port number, browser and URL...


309) Can we handle pop-ups in RC ?
Yes, we can handle pop-ups in RC... Using select Window method, pop-up window will be selected and window Focus method will let the control from current window to pop-up window and perform some actions according to our script..

310) Which method will you use for mouse left click and right click ?
For mouse left click i use 'click' method and for right click i use 'keyDown' method followed by 'click' and 'keyUp' methods i.e 'keyDown' method will press 'control' key without releasing it yet and then click method will be executed, after that 'keyUp' method will release the 'control' key..... Code will be as follows..
left click ---> selenium.click(locator)
right click ---> selenium.keyDown(locator,keysequence)
selenium.click(locator)
selenium.keyUp(locator,keysequence)

311) What is the use of 'chooseOkOnNextConfirmation()' ?
This command is used to select/click 'OK' button in the confirmation box and it must be placed before the occurrence of confirmation box...


312) What is a framework and what are the frameworks available in RC ?
Framework is nothing but a structure that allows us to do things better and faster... It is a collection of libraries and classes and they are very helpful if testers want to automate test cases.. JUnit, NUnit, TestNG, Bromine, RSpec, unittest are some of the frameworks available in RC ..


313) How do you handle secured connection error in HTTPS ?
Create an object to RemoteControlConfiguration and use setTrustAllCertificate method and set boolean value as true i.e
RemoteControlConfiguration r= new RemoteControlConfiguration();
r.setTrustAllCertificate(true);


314) If the default port of selenium is busy then which port you will use ?
We can use any port number which is valid.. First create an object to remote control configuration. Use 'setPort' method and provide valid port number(4545,5555,5655, etc).. There after attach this remote control configuration object to selenium server..i.e
RemoteControlConfiguration r= new RemoteControlConfiguration();
r.setPort(4567);
SeleniumServer s= new SeleniumServer(r);

315) How do you select second value from a drop down menu ?
Define an array of string type.. By using 'getSelectOptions' command provide locator for that particular drop down and then use 'select' command.. As 'select' command parameters are locator and the label, in-place of label, define array index... i.e,.
String a[]=selenium.getSelectOptions(locator of drop down);
selenium.select("locator of drop down", a[1]);
note: If you want to select 5th value from drop down, then provide '4' in the index of an array because array index starts from 'zero'...


316) What is the difference between sleep() and setSpeed() methods ?
Both will delay the speed of execution... When you use Thread.sleep(), then the execution of your test will be stopped until the time you have provided in sleep method, it will wait only once where the command is used where as using setSpeed() method we can set the time of delay which will follow each and every selenium command i.e if you set 5000 milliseconds then your test execution will wait 5 seconds after each and every selenium operation

317) How can we submit a form in selenium?
Using submit() method we can submit a form in selenium.

driver.findElement(By.id("form1")).submit();

Also, the click() method can be used for the same purpose.

318) Explain the difference between close and quit command.

driver.close() - Used to close the current browser having focus
driver.quit() - Used to close all the browser instances

319) How to switch between multiple windows in selenium?
Selenium has driver.getWindowHandles() and driver.switchTo().window("{windowHandleName}") commands to work with multiple windows. The getWindowHandles() command returns a list of ids corresponding to each window and on passing a particular window handle to driver.switchTo().window("{windowHandleName}") command we can switch control/focus to that particular window.

for (String windowHandle : driver.getWindowHandles()) {

driver.switchTo().window(handle);

}

320). What is the difference between driver.getWindowHandle() and driver.getWindowHandles() in selenium?

driver.getWindowHandle() returns a handle of the current page (a unique identifier)
Whereas driver.getWindowHandles() returns a set of handles of the all the pages available.

321) How can we move to a particular frame in selenium?
The driver.switchTo() commands can be used for switching to frames.

driver.switchTo().frame("{frameIndex/frameId/frameName}");

For locating a frame we can either use the index (starting from 0), its name or Id.

322) Can we move back and forward in browser using selenium?

Yes, using driver.navigate().back() and driver.navigate().forward() commands we can move backward and forward in a browser.

323) Is there a way to refresh browser using selenium?

There a multiple ways to refresh a page in selenium-

  • Using driver.navigate().refresh() command
  • Using sendKeys(Keys.F5) on any textbox on the webpage1
  • Using driver.get("URL") on the current URL or using driver.getCurrentUrl()
  • Using driver.navigate().to("URL") on the current URL or driver.navigate().to(driver.getCurrentUrl());

324) How can we maximize browser window in selenium?

We can maximize browser window in selenium using following command-

driver.manage().window().maximize();

325) How can we fetch a text written over an element?
Using getText() method we can fetch the text over an element.

String text = driver.findElement("elementLocator").getText();


326) How can we find the value of different attributes like name, class, value of an element?

Using getAttribute("{attributeName}") method we can find the value of different attrbutes of an element e.g.-

String valueAttribute =

driver.findElement(By.id("elementLocator")).getAttribute("value");


327) How to delete cookies in selenium?

Using deleteAllCookies() method-

driver.manage().deleteAllCookies();


328). What is an implicit wait in selenium?

An implicit wait is a type of wait which waits for a specified time while locating an element before throwing NoSuchElementException. As by default selenium tries to find elements immediately when required without any wait. So, it is good to use implicit wait. This wait is applied to all the elements of the current driver instance.

driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);


329). What is an explicit wait in selenium?

An explicit wait is a type of wait which is applied to a particular web element untill the expected condition specified is met.

WebDriverWait wait = new WebDriverWait(driver, 10);

WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("elementId")));

330) ) How do you launch IE/chrome browser?
Before launching IE or Chrome browser we need to set the System property.

331) How to perform right click using WebDriver?
Use Actions class
Actions act = new Actions(driver); // where driver is WebDriver type
act.moveToElement(webElement).perform();
act.contextClick().perform();

332) How do perform drag and drop using WebDriver?
Use Action class
Actions act = new Actions(driver);
WebElement source = driver.findElement(By.xpath(“ —–”)); //source ele which you want to drag
WebElement target = driver.findElement(By.xpath(“ —–”)); //target where you want to drop
act.dragAndDrop(source,target).perform();

333) Give the example for method overload in WebDriver.

frame(string), frame(int), frame(WebElement).

334) How do you upload a file?
To upload a file we can use sendKeys() method.
driver.findElement(By.xpath(“input field”)).sendKeys(“path of the file which u want to upload”);

335) How do you click on a menu item in a drop down menu?
If that menu has been created by using select tag then we can use the methods selectByValue() or selectByIndex() or selectByVisibleText(). These are the methods of the Select class.

If the menu has not been created by using the select tag then we can simply find the xpath of that element and click on that to select.

336) How do you simulate browser back and forward ?
driver.navigate().back();
driver.navigate().forward();

337) How do you get the current page URL ?
driver.getCurrentUrl();

338) What is the difference between ‘/’ and ‘//’ ?
//- it is used to search in the entire structure.

/- it is used to identify the immediate child.

339) Compare HP QTP vs Selenium?
When QA team considers acquiring test automation to assist in testing, one of the most critical decisions is what technologies or tools to use to automate the testing. The most obvious approach will be to look to the software market and evaluate a few test automation tools. Read Selenium vs QTP comparison

340) How to test Ajax application with Selenium?
Ajax interview questions could be tough for newbie in the test automation, but will be easily cracked by Selenium Tester with a relevant experience. Read the detailed approach at Testing Ajax applications with Selenium in the right way

341) How can I learn to automate testing using Selenium?
Don't be surprised if the interviewer asks you to describe the approach for learning Selenium. This interviewer wants to hear how you can innovative software test automation process the company. Most likely they are looking for software professional with a good Selenium experience, who can do Selenium training for team members and get the team started with test automation. I hope this Selenium tutorial will be helpful in the preparation for this Selenium interview question.

342) What are the main components of Selenium testing tools?
Selenium IDE, Selenium RC and Selenium Grid

343) What is Selenium IDE?
Selenium IDE is for building Selenium test cases. It operates as a Mozilla Firefox add on and provides an easy to use interface for developing and running individual test cases or entire test suites. Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back.

344) What is the use of context menu in Selenium IDE?
It allows the user to pick from a list of assertions and verifications for the selected location.

345) Can tests recorded using Selenium IDE be run in other browsers?
Yes. Although Selenium IDE is a Firefox add on, however, tests created in it can also be run in other browsers by using Selenium RC (Selenium Remote Control) and specifying the name of the test suite in command line.

346) What are the advantage and features of Selenium IDE?
a. Intelligent field selection will use IDs, names, or XPath as needed
b. It is a record & playback tool and the script format can be written in various languages including C#, Java, PERL, Python, PHP, HTML
c. Auto complete for all common Selenium commands
d. Debug and set breakpoints
e. Option to automatically assert the title of every page
f. Support for Selenium user-extensions.js file

347)What is Selenium Grid?
Selenium Grid in the selenium testing suit allows the Selenium RC solution to scale for test suites that must be run in multiple environments. Selenium Grid can be used to run multiple instances of Selenium RC on various operating system and browser configurations.

348) How Selenium Grid works?
Selenium Grid sent the tests to the hub. Then tests are redirected to an available Selenium RC, which launch the browser and run the test. Thus, it allows for running tests in parallel with the entire test suite.

349) What you say about the flexibility of Selenium test suite?
Selenium testing suite is highly flexible. There are multiple ways to add functionality to Selenium framework to customize test automation. As compared to other test automation tools, it is Selenium’s strongest characteristic. Selenium Remote Control support for multiple programming and scripting languages allows the test automation engineer to build any logic they need into their automated testing and to use a preferred programming or scripting language of one’s choice.

350) What is the cost of Selenium test suite?
Selenium test suite a set of open source software tool, it is free of cost.

351) What is the difference between selenium and UFT (QTP)?
Selenium is open source. It support multiple browser.It support various programming and scripting language. It requires install firebug and fire path plugins to inspect elements.
UFT is vender tool (license tool). It support only MS window.It support VB script only. It has built in object spy to inspect elements.

352) What are the testing framework used in selenium?
Junit (helps to execute test batches and generate test report) and TestNG (used to execute test suite and parallel testing).

353) How to configure selenium?
a] Download and install java software
b] Dowload and extract IDE
c] Download and install firbug and fire path plugins for firefox browser to inspect elements
d] Download selenium webdriver

354) What distinguishes between an absolute and relative URL in SIDE?
Absolute URL: Its is base url and this represent domain address.
Relative URL: (Absolute URL + Page Path).
Open command uses Base URL (Absolute URL) to navigate web page.

Q:355) What is the difference between driver.close() and driver.quit()?

driver.close(): It is used to close the browser or page currently in focus.
driver.quit(): It is used to shutdown the webdriver and close all instances associated to webdriver.

356) What are locators?

Locators can be termed as address to elements on the page, which makes possibility to identify element uniquely on the page.

357) What are the different locators available in Selenium WebDriver?

Following are the different types of locators available in Selenium WebDriver :-
1). ID
2). Name
3). ClassName
4). Xpath
5). CSS Selector
6). LinkText
7). PartialLink Text
8). TagName

358) What is the xpath?
XPaththeXML Path language, is a query language for selecting nodes from an XML document.
It enables to traverse through every node across the entire page and help in finding element with reference to another element on Page.

359) What are starts-with() and contains()function in xpath?
XPaththestarts-with():It is used when starting path is static & end part is dynamic
Syntax : //*[starts-with(@id, ”)]/a
XPaththecontains():It is used when middle path is static & starting and end part is dynamic
Syntax : //*[contains(@id, ”)]/a
XPaththeends-with():It is used when ending path is static & starting part is dynamic
Syntax : //*[ends-with(@id, ”)]/a

Q:What is the difference between ‘/’ and ‘//’ ??

Ans : //: It is used to search in the entire structure.
/: It is used to identify the immediate child.

360) Why ID is most preferable way to identify the elements?

Using the ID attribute is most preferable way to identify the element.
W3C recommends that every developer should provide id attribute to elements which are unique on the page.
While processing the DOM(Document Object Model), browsers use id as the preferred way to identify the element and this provides the fastest locator strategy

361). How can we move to parent of an element using XPath?

Using '..' expression in XPath we can move to parent of an element.




362). How can we move to nth child element using XPath?

Using square brackets with value n (# of the child) we can move to nth element e.g. div[n] will find nth div element.




363) What is the syntax of finding elements by class using CSS Selector?

. By .className we can select all the element belonging to a particluar class e.g. '.red' will select all elements having class 'red'.




364). What is the syntax of finding elements by id using CSS Selector?

By #idValue we can select all the element belonging to a particluar class e.g. '#userId' will select the element having id - userId.




365) How can we select elements by their attribute value using CSS Selector?

Using [attribute=value] we can select all the element belonging to a particluar class e.g. '[type=small]' will select the element having attribute type of value 'small'.



366). How can we move to nth child element using css selector?

Using :nth-child(n) we can move to the nth child element e.g. div:nth-child(2) will locate 2nd div element of its parent.




367). What is fundamental difference between XPath and css selector?

The fundamental difference between XPath and css selector is using XPaths we traverse up in the document i.e. we can move to parent elements. Whereas using CSS selector we can only move downwards in the document.




368) How can we launch different browsers in selenium webdriver?

By creating an instance of driver of a particular browser-

WebDriver driver = new FirefoxDriver();

369) What is Selenium 2.0?

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

370) 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

ist 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

371) 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 is expected. The types of assertion are “assert” , “verify” and “waifFor”.

372) 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.

373) 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

374) List out the technical challenges with Selenium?

Technical challenges with Selenium are

– 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

375) What is the cost of Selenium ?
Since, selenium is an open source, it is free of cost..


376) What are the main components / flavors of Selenium ?

Selenium IDE (Integrated Development Environment)

Selenium RC (Remote Control)

Selenium Grid

Selenium Webdriver

377) What tests can selenium do ?
Selenium is mainly used for Functional testing, Regression testing and Load/Stress testing for web based applications...


378) What are the advantages and disadvantages of selenium ?
Advantages :
Its main advantage is that it is free of cost.

Installation of selenium software is easy.

Record and play back feature is available.

Selenium supports multiple operating systems and runs in many browsers.

It has a feature of converting scripts into other languages like Java, C#, Python, Ruby, etc..

Good support for Agile(methodology) projects.

Disadvantages :
Complete set-up of selenium is somewhat critical.

It is not suitable for Client-Server applications.

Boring error analysis.

Selenium does not support back end test.

Support provided for Selenium would be very less.

379) Name some browsers that support Selenium ?

Firefox

Internet Explorer

Safari

Opera

Google Chrome

380) Operating systems that support Selenium..

Windows

Mac

Linux

Solaris

381) Programming languages that support Selenium(with RC)..

Java

C#

Perl

PHP

Python

Ruby

382) 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. It’s 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.

383) Explain Selenium WaitFor Commands ?

  • waitForPageToLoad : This command will make the script to wait till the page loads.Syntax is waitForPageToLoad(timeout); Time out is the maximum time the script will wait for the page to load.
  • waitForAlert : This command will wait for the alert message to appear
  • waitForTable: This command will wait for the Web table to completely load in the page
  • waitForTitle: This command will for the page Title to appear on the browser.
  • Other waitFor commands : Selenium has several other wait command like waitForText,waitForPopup and so on. These commands are generically called Synchronization commands

384) How you can use “submit” a form using Selenium ?

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

385) 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

386) 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

387) What is Selenium IDE?
Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test cases, which QA Tester can play back in the Firefox browser or export to Selenium RC. Selenium IDE has the following features: record/play feature, debugging with step-by-step and breakpoints, page abstraction functionality, an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE

388) What are the limitations of Selenium IDE?
Selenium IDE has many great features and is a fruitful and well-organized test automation tool for developing 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, database testing, re-execution of failed tests and screenshots taking capability. Selenium IDE doesn't for IE, Safari and Opera browsers.

389) What does SIDE stand for?
Selenium IDE. It was a very tricky interview question.

390) What is Selenium Remote Control (RC) tool?
Selenium Remote Control (RC) is the powerful solution for test cases that need more than simple browser actions and linear execution. Selenium-RC allows the developing of complex test scenarios like reading and writing files, querying a database, and emailing test reports. These tasks can be achieved by tweaking test cases in your preferred programming language.

391) What are the advantages using Selenium as testing tool?
If QA Tester would compare Selenium with HP QTP or Micro Focus SilkTest, QA Engineer would easily notice tremendous cost savings for Selenium. In contrast to expensive SilkTest license or QTP license, Selenium automation tool is absolutely free. It means that with almost no investment in purchasing tools, QA Team could easily build the state of the art test automation infrastructure. Selenium allows developing and executing test cases in various programming languages including .NET, Java, Perl, RubyPython, PHP and even HTML. This is a great Selenium advantage, most likely your software developers already know how to develop and maintain C# or Java code, so they transfer coding techniques and best practices to QA team. Selenium allows simple and powerful DOM-level testing and in the same time could be used for testing in the traditional waterfall or modern Agile environments. Selenium would be definitely a great fit for the continuous integration tools Jenkins, Hudson, CruiseControl, because it could be installed on the server testing box, and controlled remotely from continuous integration build.

392) What is Selenium Grid?
Selenium Grid extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel.

393) What is Selenium WebDriver?
Selenium WebDriver is a tool for writing automated tests of websites. It is an API name and aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor of Selenium Remote Control which has been officially deprecated.

394) How many browsers are supported by Selenium IDE?
Test Engineer can record and playback test with Selenium IDE in Firefox.

395) Can Selenium test an application on iPhone's Mobile Safari browser?
Selenium should be able to handle Mobile Safari browser. There is experimental Selenium IPhone Driver for running tests on Mobile Safari on the iPhone, iPad and iPod Touch.

396 ) 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

397) 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

398) In which format does source view shows your script in Selenium IDE ?

In Selenium IDE source view shows your script in XML format

399) Explain how you can insert a start point in Selenium IDE?

In two ways selenium IDE can be set

  • Press “S” key on the keyboard and select the command in Selenium IDE
  • In Seleniun IDE right click on the command and the select “Set / Clear Start Point”

400) How will you handle working with multiple windows in Selenium ?

We can use the command selectWindow to switch between windows. This command uses the title of Windows to identify which window to switch to.

401) Can Selenium handle windows based pop up?

Selenium is an automation testing tool which supports only web application testing. Therefore, windows pop up cannot be handled using Selenium.

402) 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.

403) What are the four parameters that you need to pass in Selenium?

The four parameters that you have to pass in Selenium are:

  • Host
  • Port Number
  • Browser
  • URL

404 ) 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.

405) What browsers are supported by Selenium Remote Control?
The test automation expert can use Firefox, IE 7/8, Safari and Opera browsers to run tests in Selenium Remote Control.

406) What programming languages can you use in Selenium RC?
C#, Java, Perl, PHP, Python, Ruby

407) What are the advantages and disadvantages of using Selenium as testing tool?
Advantages: Free, Simple and powerful DOM (document object model) level testing, can be used for continuous integration; great fit with Agile projects.

Disadvantages: Tricky setup; dreary errors diagnosis; can not test client server applications.

408) What is difference between QTP and Selenium?
Only web applications can be testing using Selenium testing suite. However, QTP can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer,

Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, QTP is limited to Internet Explorer on Windows.

409) What is difference between Borland Silk test and Selenium?
Selenium is completely free test automation tool, while Silk Test is not. Only web applications can be testing using Selenium testing suite. However, Silk Test can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Internet Explorer and Firefox.

Silk Test uses 4Test scripting language. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.

410) What is the difference between an assert and a verify with Selenium commands?
Effectively an “assert” will fail the test and abort the current test case, whereas a “verify” will fail the test and continue to run the test case.

411) Why should Selenium be selected as a test tool?

Selenium

412) . 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 playing back. 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

413) What do we mean by Selenium 1 and Selenium 2?

Selenium RC and WebDriver, in a combination are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium 1.

414) Which is the latest Selenium tool?

WebDriver

415) What are the testing types that can be supported by Selenium?

Selenium supports the following types of testing:

Functional Testing Regression Testing

416) Why should Selenium be selected as a test tool?

Selenium 1.is free and open source 2.have a large user base and helping communities 3.have cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.) 4.have great platform compatibility (Windows, Mac OS, Linux etc.) 5.supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) 6.has fresh and regular repository developments 7.supports distributed testing

417) What are the different types of waits available in WebDriver?

There are two types of waits available in WebDriver: 1.Implicit Wait 2.Explicit Wait Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command. Explicit Wait: Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.

418) What are the different keyboard operations that can be performed in selenium?

The different keyboard operations that can be performed in selenium are-

  • .sendKeys("sequence of characters") - Used for passing charcter sequesnce to an input or textbox element.
  • .pressKey("non-text keys") - Used for keys like control, function keys etc that ae non text.
  • .releaseKey("non-text keys") - Used in conjuntion with keypress event to simulate releasing a key from keyboard event.



419) What are the different mouse actions that can be performed?

The different mouse evenets supported in selenium are

  • click(WebElement element)
  • doubleClick(WebElement element)
  • contextClick(WebElement element)
  • mouseDown(WebElement element)
  • mouseUp(WebElement element)
  • mouseMove(WebElement element)
  • mouseMove(WebElement element, long xOffset, long yOffset)

420)Write the code to double click an element in selenium?

Code to double click an element in selenium-

Actions action = new Actions(driver);

WebElement element=driver.findElement(By.id("elementId"));

action.doubleClick(element).perform();

421) . Write the code to right click an element in selenium?

Code to right click an element in selenium-

Actions action = new Actions(driver);

WebElement element=driver.findElement(By.id("elementId"));

action.contextClick(element).perform();

422)How to mouse hover an element in selenium?

Code to mouse hover over an element in selenium-

Actions action = new Actions(driver);

WebElement element=driver.findElement(By.id("elementId"));

action.moveToElement(element).perform();

423) What are the selenium locators and what is the tool you use to identify element ?

Selenium locators are the way of finding HTML element on the page to perform Selenium actions... We use firebug(for firefox) to identify elements as it is more popular and powerful web development tool.. It inspects HTML and modify style and layout in real-time.. We can edit, debug and monitor CSS, HTML and Javascript live in any web page..

-->For Internet Explorer we can choose debugbar.. It views HTML DOM tree, we can view and edit tab attributes..


424) How do you locate elements in IDE ?
I will focus on the unique attribute values like id, name or other structural information that is stable enough to withstand frequent changes to the web application.. I strongly recommend CSS selectors as locating strategy.. They are considerably faster than xpath and can find the most complicated objects in any HTML document..


425) What is selenese ?
Selenium set of commands that run our test is called Selenese.. A sequence of these commands is a test script.. There are three types of selenese..

Actions : They perform some operations like clicking a link or typing text in text box or selecting an option from drop-down box etc..

Assertions : They verify that the state of application conforms to what is expected.. Ex: 'verify that this checkbox is checked', 'make sure that the page title is X'..

Accessors : Checks the state of application and store the results in a variable.. Ex: storeText, storeTitle, etc..


426) How do you add check points or verification points ?
They are called as Assertions in selenium.. 'assert', 'verify' and 'waitFor' are the commands used to add check points..
Ex: assertText, verifyElementPresent, waitForTextPresent, etc..

427) Name some commands that you use frequently in IDE ?
A) Open, click, type, select, assertText, assertTitle, assertTextPresent, verifyText, verifyTextPresent, veriftTitle, waitForText, waitForTextPresent, waitForTitle, store, storeText, storeTitle, check, uncheck, pause, mouseover, etc..

428) What is the difference between assert and verify ?
When an 'assert' fails, the test is aborted where as when 'verify' fails, the test will continue execution logging the failure..
'assert' is used when the expected value is mandatory to continue with next set of steps.. However 'verify' is used when the expected value is optional to continue with the next set of steps..

429) Difference between waitFor and pause commands ?
'waitFor' command waits for some condition to become true..
For example, 'waitForPageToLoad(20000)'-- it will wait upto 20 thousand milliseconds to load required page.. If the page is loaded before 20,000ms then it jumps to next step to execute.. If the page is not loaded before 20,000ms then it stops the execution due to time-out error..
--> pause command stops the execution of the test until the specified time..
Ex: pause(10000)-- It stops the execution of test for 1o thousand milliseconds.. After completing 10,000ms it jumps to next command to execute.. I prefer 'waitFor' command than 'pause'..


430) How do you export tests from Selenium IDE to RC ?
First i will open the test in IDE, which should be exported to RC.. There after i'l select 'File' from the menu bar.. when we mouseover on 'Export Test Case As' in the file menu, we could see different languages like C#, Java, Python and Ruby.. Select the language you want to export your test and provide the name to save it.

.423)How to fetch the current page URL in selenium?

Using getCurrentURL() command we can fetch the current page URL-

driver.getCurrentUrl();

431) What are the disadvantages of using Selenium as testing tool?
Selenium weak points are tricky setup; dreary errors diagnosis; tests only web applications

432) How many browsers are supported by Selenium Remote Control?
QA Engineer can use Firefox 7, IE 8, Safari 5 and Opera 11.5 browsers to run actuall tests in Selenium RC.

433) How many programming languages can you use in Selenium RC?
Several programming languages are supported by Selenium Remote Control - C# Java Perl PHP Python Ruby

434) How many testing framework can QA Tester use in Selenium RC?
Testing frameworks aren't required, but they can be helpful if QA Tester wants to automate test cases. Selenium RC supports Bromine, JUnit, NUnit, RSpec (Ruby), Test::Unit (Ruby), TestNG (Java), unittest (Python).

435) How to developer Selenium Test Cases?
Using the Selenium IDE, QA Tester can record a test to comprehend the syntax of Selenium IDE commands, or to check the basic syntax for a specific type of user interface. Keep in mind that Selenium IDE recorder is not clever as QA Testers want it to be. Quality assurance team should never consider Selenium IDE as a "record, save, and run it" tool, all the time anticipate reworking a recorded test cases to make them maintainable in the future.

436) Why Selenium RC is used?

Selenium IDE does not directly support many functions like condition statements, Iteration, logging and reporting of test results, unexpected error handling and so on as IDE supports only HTML language. To handle such issues Selenium RC is used it supports the language like Perl, Ruby, Python, PHP using these languages we can write the program to achieve the IDE issues.

437) Explain what is the main difference between web-driver and RC ?

The main difference between Selenium RC and Webdriver is that, selenium RC injects javascript function into browsers when the page is loaded. On the other hand, Selenium Webdriver drives the browser using browsers built in support

438) What are the technical limitations while using Selenium RC?

Apart from “same origin policy” restriction from js, Selenium is also restricted from exercising anything that is outside browser.

439 ) Why to use TestNG with Selenium RC ?

If you want full automation against different server and client platforms, You need a way to invoke the tests from a command line process, reports that tells you what happened and flexibility in how you create your test suites. TestNG gives that flexibility.

440) What is WebDriver Backed Selenium ?

WebDriverBackedSelenium is a kind of class name where we can create an object for it as below:

1

Selenium wbdriver= new WebDriverBackedSelenium(WebDriver object name, "URL path of website")

The main use of this is when we want to write code using both WebDriver and Selenium RC , we must use above created object to use selenium commands.

441) How do you handle https website in selenium ?

By changing the setting of FirefoxProfile.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Syntax-public class HTTPSSecuredConnection {

public static void main(String[] args){

FirefoxProfile profile = new FirefoxProfile();

profile.setAcceptUntrustedCertificates(false);

WebDriver driver = new FirefoxDriver(profile);

driver.get("url");

}

}

442) What is the name of Headless browser.

HtmlUnitDriver.

443) What are the browsers supported by Selenium IDE ?

Mozilla FireFox only. Its an Firefox add on.

444) What are the flavors of selenium ?

selenium IDE, selenium RC, Selenium WebDriver and Selenium Grid.

445) Advantages of selenium over other tools ?

a) Its free of cost

446) What are the main components of Selenium testing tools?
Selenium IDE, Selenium RC and Selenium Grid

47) What are the types of text patterns available in Selenium?

There are three types of patterns available in Selenium:

globbing

  • regular expressions
  • exact

448 ) Can Selenium test a application on iPhone’s Mobile Safari browser?

Selenium can handle Mobile Safari browser. There is experimental Selenium IPhone Driver for running tests on Mobile with Safari on the iPhone and iPad and iPod Touch

449) Can Selenium test an application on Android browser?

Selenium can handle Android browser.

450) What tests can selenium do?

Selenium could do functional, regression, and load of web based applicationsn many languages like Java, C#, Ruby, Python etc.,


Selenium Interview Questions 1

Selenium Interview Questions 2

Selenium Interview Questions 3

Selenium Interview Questions 4