Interview Questions.

Selenium Interview Questions

fluid

Selenium Interview Questions

Every aspiring tester, in particular one aiming to work with net-primarily based applications, should have true know-how approximately Selenium. This is because on every occasion making use of for some process opportunity regarding web-based totally checking out these days, assume Selenium-based totally questions coming your way.

Written absolutely in Java, Selenium is one of the most broadly used automation checking out tools. It is straightforward to apply, easy and provides assist for writing check scripts in a extensive kind of programming languages, together with C#, Groovy, Java, Perl, and Python.

Selenium Interview Questions

Here, we've got collected the pinnacle Selenium interview questions that will help you append your extant Selenium understanding in addition to take a look at how nicely you fare in opposition to an array of Selenium interview questions thrown right at you. So, permit’s bounce proper into it:

Question: Please give an explanation for the numerous Selenium additives.

Answer: Although categorised as an automation trying out device, Selenium isn’t a standalone tool. Instead, it's miles a package deal of numerous gear, and thus a testing suite. The Selenium suite has the subsequent components:

Selenium IDE – Distributed as a Firefox plugin, Selenium IDE serves as a report and playback device.

Selenium Grid – Allows dispensing test execution throughout a couple of systems and environments simultaneously.

Selenium RC – A server that permits customers to create test scripts in a suitable programming language. Selenium RC also permits executing test scripts across a diverse variety of internet browsers.

Selenium WebDriver – Communicated at once with the internet browser similarly to the usage of its native compatibility to automate.

Question: Could you state the restrictions of Selenium?

Answer:

Although Selenium has an lively network aid, no dealer support is available

No built-in report era. Third-party equipment like JUnit and TestNG need for use

Not capable of offer checking out for barcode and captcha readers

Requires excellent programming language information

Supports checking out of handiest net-based totally packages. Hence, doesn’t offer guide for testing mobile applications

Question: What are the different kinds of locators in Selenium?

Answer: A locator is a type of cope with that offers a completely unique manner of figuring out an internet detail on the web site. Selenium has various locators to identify different elements of a webpage, specifically:

ClassName

CSS Selector

DOM

ID

LinkText

Name

PartialLinkText

TagName

XPath

Question: Can you explain the distinction among assert and affirm instructions in Selenium?

Answer: Both assert and verify instructions are liable for checking whether the given condition is real or fake. However, the primary distinction between the 2 lies what each of them does after the situation checking is entire.

If the condition comes out to be fake inside the case of a confirm command, then the execution stops and no in addition checks can be done. However, if the circumstance is actual then the program manipulate will keep executing the subsequent test step.

Verify command, on the other hand, does no longer care about the result of the situation checking. Whether it's far actual or fake, the program execution continues and all the check steps will be completed.

Question: What do you apprehend through XPath in Selenium? Can you tell the distinction between “/” and “//” in XPath?

Answer: XPath is a kind of locator in Selenium that is used to discover a web element primarily based on its XML route. XML denotes Extensible Markup Language, that is used for storing, organizing, and transporting arbitrary data. Much like HTML tags, XML stores information in a key-value pair.

Since HTML and XML each are markup languages, XPath can be used for locating HTML factors on a webpage. The underlying principle of XPath is traversing between numerous elements throughout the whole web site and permitting them to locate an element with the reference of a few other element.

The unmarried diminish i.E. ‘/’ is used to create XPath with the absolute direction, whilst the double cut back i.E. ‘//’ is used for growing XPath with the relative path.

In absolutely the direction, the created XPath will begin choice from the document node or the start node. However, inside the relative course, the created XPath can begin choice from everywhere inside the complete web document.

Question: How will you release the browser using WebDriver?

Answer: The syntax used for launching Google Chrome, Mozilla Firefox, and Internet Explorer the usage of WebDriver is respectively,

WebDriver driving force = new FirefoxDriver();

WebDriver motive force = new ChromeDriver();

WebDriver motive force = new InternetExplorerDriver();

Question: Please explain how to find if an element is displayed at the display screen.

Answer: The WebDriver factor of the Selenium suite facilitates checking the visibility of internet elements, which may be buttons, checkboxes, drop boxes, labels, radio buttons, et cetera. WebDriver permits doing so with the following three strategies:

isDisplayed()
boolean buttonPresence = driver.findElement(By.id(“some id”)).isDisplayed();
isEnabled()
boolean searchIconEnabled = driver.findElement(By.id(“some id”)).isEnabled();
isSelected()
boolean buttonSelected = driver.findElement(By.id(“some id”)).isSelected();

Question: What do you imply with the aid of Same Origin Policy? How to handle it?

Answer: An Origin is a sequential combination of host, scheme, and port of the URL. The trouble of the same-origin coverage restricts accessing the DOM of a record from an starting place that is special from the one that a person is trying to get right of entry to the record.

The Selenium Core isn’t allowed to get right of entry to the elements from an starting place that is distinct from where it become launched. Selenium Remote Control turned into introduced with the intention to deal with the problem of Same Origin Policy.

Question: Do you recognize how to get a text of an internet detail using Selenium?

Answer: In order to retrieve the internal textual content of a unique internet detail, Selenium offers the get command. It returns a string value and doesn’t require any parameters. Get command is one of the most extensively used instructions for verifying errors, labels, messages, etc. Displayed on webpages. The fashionable syntax for the get command is:

String Text = driver.findElement(By.id(“Text”)).getText();

Question: Please enumerate the various styles of Drivers and Waits to be had in WebDriver.

Answer: WebDriver gives support for the subsequent drivers:

AndroidDriver

ChromeDriver

FirefoxDriver

HtmlUnitDriver

InternetExplorerDriver

IPhoneDriver

OperaDriver

SafariDriver

There are two styles of waits to be had in WebDriver, explained as follows:

Implicit Wait – Used for providing a default ready time among each successive test step or command across the complete test script. Hence, the following test step or command will handiest execute when the set default ready time, say 30 seconds, have surpassed since the execution of completion of the previous take a look at step or command. Can be implemented to a selected example or numerous instances.

Explicit Wait – Used for halting the execution until the occurrence of a particular circumstance or till the elapsing of the maximum time. Applied for a specific instance simplest.

Question: What do you apprehend by Object Repository? How do you create one in Selenium?

Answer: The term Object Repository refers to the collection of web elements that belong to AUT (Application Under Test) and their locator values. A corresponding locator fee may be populated from the Object Repository on every occasion an element is required within the script.

Instead of hardcoding locators within the scripts, they may be saved in a centralized region using Object Repository. Typically, the items are saved in an excel sheet in Selenium which acts because the Object Repository.

Question: Please give an explanation for how to click on on a hyperlink the usage of its textual content.

Answer: The following command finds a distinctive element using the linkText() technique and then clicks on that detail to redirect the user to the corresponding webpage:

driver.findElement(By.linkText(“Google”)).click();

Another command that may be used for the equal motive is:

driver.findElement(By.partialLinkText(“Goo”)).click();

In this command, we use the partialLinkText() method. The aforementioned command unearths the detail based at the substring, Goo in this case, of the link supplied.

Question: What is the most crucial distinction between driver.Close() and driving force.Cease() commands in Selenium?

Answer: The near() approach closes the currently accessed window by using the WebDriver. Neither does the command calls for any parameter nor does it returns any cost.

Unlike the near() technique, the end() technique is used for remaining down all of the home windows opened through this system. Like close() command, the end() method doesn’t require any parameter nor does have any return price type.

Question: How will you find multiple web element in the listing the usage of Selenium?

Answer: Selenium gives WebElement List for locating more than a unmarried internet element in the list. Its use is demonstrated by using the following code snippet:

List elementList =
driver.findElements(By.xpath(“//div[@id=‘example’]//ul//li”));
Int listSize = elementList.size();
for (int i=0; i<listSize; i++)
{
serviceProviderLinks.get(i).click();
driver.navigate().back();
}

Question: Can you explain the differences between Selenium and QTP?

Answer:

Availability – Selenium is an open-supply and loose-to-use testing device. QTP, however, is an authorized and industrial testing device.

Browser Compatibility – While QTP offers assist for only Chrome, Firefox, and Internet Explorer, Selenium may be used with the aforementioned plus Opera, Safari, and several others.

Object Repository – QTP routinely creates and keeps an Object Repository. However, this is not the case with Selenium as one wishes to create an Object Repository whilst running with the automation trying out device.

Programming Language Support – The only programming language supported via QTP is VB however Selenium presents aid for a multitude of programming languages, inclusive of C#, Java, Perl, Python, and Ruby.

Testing Support – Whereas Selenium gives testing of simplest internet applications, QTP provides testing guide for each web-primarily based and Windows-based totally packages.

Vendor Support – No supplier assist is to be had with Selenium at the same time as the equal is available for QTP.

Question: How will you take care of net-based totally pop-americain Selenium?

Answer: WebDriver allows dealing with internet-based pop-united states of americathrough the Alert interface. The fashionable syntax is:

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

A overall of 4 techniques are available for coping with the internet-primarily based pop-ups, particularly:

String getText() – Returns textual content displayed at the alert container

void take delivery of() – Clicks at the ‘Ok’ button as quickly as the pop-up seems

void disregard() – Clicks on the ‘Cancel’ button as quickly as the pop-up seems

void sendKeys(String stringToSend) – Inputs a special string sample within the alert container

Question: Can you give an explanation for the various sorts of navigation instructions supported via Selenium?

Answer: Selenium helps a total of four navigation instructions, listed as follows:

navigate().Back() – Takes the person back to the previous web site as in step with the internet browser records. Requires no parameters

navigate().Forward() – Navigates the consumer to the following web site inside the internet browser records. Requires no parameters

navigate().Refresh() – Reload all of the internet elements with the aid of fresh the present day webpage. Requires no parameters

navigate().To() – Lets the person launch a brand new web browser window and navigate to the specified URL given as a parameter

Question: When need to we use findElement() and findElements()?

Answer: findElement() – Used for finding the first element within the modern-day website matching to the specified locator price. Irrespective of the range of wonderful matches, handiest the primary element can be fetched. Its standard syntax is:

WebElement element = driver.findElements(By.xpath(“//div[@id=’some id’]//ul//li”));

findElements() – Used for locating all factors matching the desired locator value in the contemporary website. All matching factors might be fetched and stored within the list of WebElements. The fashionable syntax for the technique is:

List elementList = driver.findElements(By.xpath(“//div[@id=’some id’]//ul//li”));

Question: What is JUnit? Explain the numerous JUnit annotations.

Answer: JUnit is a Java-primarily based trying out framework from Apache that enhances Selenium. Various JUnit Annotations are enumerated as follows:

@After – Lets the machine know that this technique will be executed whenever a test method achieves completion

@AfterClass – Lets the gadget understand that this method must be done once after any of the check strategies

@Before – Lets the machine realize that this technique might be completed simply earlier than whenever a take a look at approach starts offevolved execution

@BeforeClass – Lets the system understand that this method must be finished once earlier than any of the check techniques start execution

@Ignore – Lest the system realize that this technique will be disregarded i.E. It shall no longer be completed

@Test – Lets the device recognise that this approach is a check method. It is possible to have numerous test techniques in a single check script

Question: Please provide an explanation for the various types of Test Automation Frameworks.

Answer:

Behavior-Driven Development Framework – Allows automating functional validations in an easy-to-study and comprehensible layout for distinctive experts, including analysts, developers, and testers.

Data-Driven Testing Framework – Helps in segregating the test script good judgment and the check information. Allows storing take a look at information in a few outside database within the form of key-fee pairs. These keys are used for accessing as well as populating the statistics within the check scripts.

Keyword-Driven Testing Framework – It is an extension to the information-driven checking out framework in a way that in addition to separating test records from the check scripts, a keyword-pushed testing framework shops a part of the take a look at script code in an outside records file.

Library Architecture Testing Framework – Works on the precept of figuring out the proper steps after which grouping them together into features underneath a library. These features are called within the test scripts every time required.

Module-Based Testing Framework – Divides every software underneath testing into a number of logical and remoted modules. A wonderful take a look at script is created for every module.

Hybrid Testing Framework – Offers functions belonging to special kinds of trying out frameworks. The concept is to obtain in all the blessings of diverse processes with a unmarried testing device.

Question: What is Selenium? Define its composition?

Answer: Selenium is a set of diverse equipment that are used explicitly for computerized net testing purposes. Its compositions have Selenium IDE (Integrated Development Environment), WebDriver and RC, and Grid.

Question: How are Selenium 2.0 and Selenium 3.0 different from Selenium?

Answer: Selenium 2.Zero has consolidated Selenium RC and WebDriver to make a unmarried device, even as Selenium 3.0 is the modern version, which has Beta 1 and Beta 2 updates.

Question: Identify the numerous check sorts which are supported by using Selenium?

Answer: The numerous test types that are supported by Selenium encompass the following:

Functional.

Regression.

CruiseCont.

Hudson.

Jenkins.

Quick Build.

Question: What is the position of Assertion in Selenium?

Answer: The position of Assertion in Selenium is to behave as a verification factor. It enables in verifying the state of the application that conforms to expectations. 

Question: What are the diverse types of Assertion in Selenium?

Answer: There are three forms of Assertion in Selenium, which consist of the subsequent:

Assert.

Verify.

WaitFor.

Question: What are the technical challenges with Selenium?

Answer: There are numerous technical challenges with Selenium which includes:

It most effective helps web-primarily based applications.

Bitmap evaluation is not supported.

Third-party equipment are hunted for reporting purposes.

Vendor help is minimum compared to other commercial tools together with HP UFT.

It is hard to keep objects in Selenium.

Question: Differentiate between Type Keys and Type Commands in Selenium?

Answer: Types Keys collects the distinctive fee attributes the usage of the JavaScript while the Type Commands imitates like an actual consumer typing.

Question: Differentiate among Assert and Verify commands?

Answer: Assert instructions allows in checking if the element is on the page or now not. The check will fail in case of lacking the desired element and will get terminated. Verify instructions helps in checking the element is on the page or now not but will not terminate but will maintain beforehand on executing all the instructions.

Question: What are the distinct features of Selenium?

Answer: The wonderful features of Selenium include the subsequent:

It supports C#, Python, Perl, JAVA, and PHP.

It can run on various operating systems, such as Mac OS, Linux, and Windows.

It can without problems find elements using Xpath, CSS, and DOM.

Its developer network is supported via Google.

Question: What makes Selenium higher than QTP?

Answer: The following functions of Selenium makes it higher than QTP:

Selenium

QTP

It is an open-source

It is a commercial tool

It is used for testing various web-based applications.

It is used for web-based applications and testing client-server applications.

It supports Safari, Opera, and Firefox on Linux, Mac, and Windows.

It supports only the Internet Explorer on Windows.

It supports different programming languages such as Python, Perl, and Ruby.

It supports only VB Script.

Question: Define the parameters in Selenium?

Answer: There are 4 parameters in Selenium which incorporates:

Host.

URL.

Port Number.

Browser.

Question: What is the position of set Speed() and Sleep() techniques in Selenium?

Answer: The function of set Speed() and Sleep() in Selenium is to put off the velocity of execution.

Question: Define heightened privileges browsers?

Answer: Heightened privileges browsers acts as proxy injections that permit different web sites to do things which can be normally no longer permitted. These browsers permit Selenium middle to pen the AUT immediately and thereby read and write its content with out passing the whole AUT via the Selenium RC server.

Question: What is a Borland Silk Test Tool?

Answer: A Borland Silk Test Tool is used for the customer-server software using a take a look at scripting language.

Question: What is a Selenium Test Tool?

Answer: A Selenium Test Tool is used for web programs and has the power to many languages, along with JAVA, Perl, Ruby, and diverse others.

Question: What are the major variations among Borland Silk Test Tool and Selenium Test Tool?

Answer: The primary variations among Borland Silk Test Tool and Selenium Test Tool may be displayed as follows:

Borland Silk Test Tool

Selenium Test Tool

It is not a free testing tool.

It is a free testing tool.

It has to be applied manually.

It is an automation tool.

It supports only Internet Explorer and Firefox.

It supports all kinds of browsers, including Internet Explorer, Firefox, Safari, Opera, and various others.

It is specifically used for testing script language.

It can be applied for testing programs in various languages.

It can be applied to a client-server application.

It can be applied only to web applications.

Question: How is Webdriver useful over Selenium Server?

Answer: Webdriver does not require the Selenium Server because it makes use of a completely specific generation. It offers Selenium RC capability, which presents backward compatibility to Selenium 1.Zero. Also, it makes a right away name to the various browsers for making automation. At the identical time, inside the case of Selenium RC, it calls for the Selenium Server to enter the Javascript into the browser.

Question: What is the alternative name of Selenium WebDriver?

Answer: The different popular name of Selenium WebDriver is Selenium 2.Zero

Question: What are the wonderful features 0f Selenium WebDriver from Selenium 1.Zero?

Answer: The awesome capabilities of Selenium WebDriver from Selenium 1.0 consists of:

It helps in managing multiple frames, browsers, home windows, indicators, and pop-ups.

It enables in-web page navigation.

It gives a drag and drop facility on the page.

It applies the Ajax-based totally User Interface (UI) elements.

It offers more than one browser trying out facilities which helps in enhancing functionality for browsers which were in advance not supported via Selenium 1.Zero

Question: Can we deal with colorings in Web Driver?

Answer: Yes, we will handle colorations in Web Driver using the getCssValue(arg0) function. It will help in getting the color through sending the 'coloration' string as a controversy.

Question: Can we shop a fee, which is a text box?

Answer: Yes, we will shop a fee, that's a textual content field the usage of Web Driver. We can follow motive force.FindElement(By.Id(“your Textbox”)).SendKeys(“your keyword”);

Question: Can we Switch among frames?

Answer: Yes, we will Switch among frames the use of the WebDrivers, which could take any arguments.

Question: What are the three arguments that can be taken into consideration for Switching?

Answer: The three arguments that can be considered for Switching includes:

A wide variety: This will pick the variety with the aid of its 0-primarily based index.

A call or ID: This will pick out a frame through its name or ID.

Previously determined WebElement: This will help in using the formerly located WebElement to choose a frame.

Question: What are the exceptions to Selenium WebDriver?

Answer: There are 5 special exceptions to Selenium WebDriver which incorporates:

TimeoutException.

WebDriverException.

NoAlertPresentException.

NoSuchElementException.

NoSuchWindowException.

Question: Which is the satisfactory WebDriver implementation?

Answer: The first-class WebDriver implementation of the HTML unit is the fastest because it does not execute the checks on the browsers but applies plain HTTP request, which is quick and allows in launching the browser and executing the checks.

Conclusion

Well, that sums up the list of the pinnacle Selenium interview questions and answers. Going via the list will surely assist you tighten up your coaching for that upcoming Selenium interview. 

Are you searching out greater Selenium interview questions? Here is a good direction that will help you prepare for an upcoming Selenium Testing Interview Questions: QA training for Selenium Automation and Agile Interview.

Some familiar information structure-primarily based questions are standard in software program checking out interviews. Go beforehand and don't forget shopping for this high-quality programming hack book dubbed Cracking the Coding Interview: Cracking the Coding Interview: 189 Programming Questions and Solutions.

Please go away your feedback in the remarks window below and don’t neglect to test out some of the great Selenium tutorials to step up your internet-based software trying out recreation. All the fine!




CFG