Selenium-Interview-Questions-And-Answers

Selenium Interview Questions and Answers

Selenium is a famous Software testing Tool. Here we have provided you with 74 .Selenium interview questions and answers. You can recall whatever you have learned in Selenium through these questions. These questions will also help you to boost your confidence level.

Get Selenium Training in Chennai from Experts. Call us @ +91 86087 00340 for a free demo session!

1. What is the automation test?

The automation test or automation test is a manual process automation process to test the application / system under test. Automation testing involves the use of a separate testing tool that allows you to create test scripts that can be run repeatedly and require no manual intervention.

2.What are the benefits of automation testing?

The benefits of automation testing are: It supports running repeated test cases. Helps test a large array of tests. Allows parallel execution. Encourages unattended execution. Improves accuracy and reduces errors. Man-Made Mistakes Save Time and Money.

3. Why should Selenium be selected as a testing tool?

Selenium is free and open source, has a large user base and helps communities, as well as compatibility between browsers (Firefox, Chrome, Internet Explorer, Safari, etc.). The great platform compatibility (Windows, Mac OS, Linux, etc.) supports multiple programming languages (Java, C #, Ruby, Python, Pearl, etc.). It has new and regular repositories developments. It supports distributed testing

4. What is selenium? What are the different components of Selenium?

Selenium is one of the most popular automated test suites. Selenium is designed to support and encourage automated testing of the functional aspects of Web-based applications and a wide variety of browsers and platforms. Due to its existence in the open source community, it has become one of the most widely accepted tools among testers because selenium is not just a tool or utility but a bundle of various testing tools and for the same reason it is known as a suite. Selenium Integrated Development Environment (IDE):

Selenium IDE is a recording and playback tool. Selenium IDE is a tool for recording and playback. It is distributed as a plugin for Firefox.Selenium Remote Control (RC): Selenium RC is a server that allows the user to create test scripts in the desired programming language. It also allows you to run test scripts within a wide range of browsers: Selenium WebDriver – WebDriver is a completely different tool that has several advantages over Selenium RC. WebDriver communicates directly with the Web browser and uses its native compatibility to automate: Selenium Grid: Selenium Grid is used to distribute your test run across multiple platforms and environments simultaneously.

5. What kinds of tests can Selenium support?

Selenium supports the following types of tests: Functional tests Regression tests

6. When should I use Selenium IDE?

Selenium IDE is the simplest and simplest tool in the Selenium package. Its recording and playback function makes it exceptionally easy to learn with the least knowledge of any programming language. Selenium IDE is an ideal tool for a naive user.

7. What is Selenese?

Selenese is the language used to write test scripts in Selenium IDE.

8. What are the different types of locators in Selenium?

The locator may be referred to as an address that uniquely identifies a web element within the web page. So to identify web elements accurately and accurately, we have different types of locators in Selenium:

  • IDENTITY CARD
  • Name of the class
  • Name
  • Name of the tag
  • Text link
  • PartialLink
  • TextXpath
  • Selector of the CSS
  • DOM

9. What is the difference between the commit and verify commands?

Assert: Assert checks whether the given condition is true or false. Let’s say we say whether the given element is present on the web page or not. If the condition is true, then the control of the program will execute the next test step, but if the condition is false, execution is stopped and no other test will be performed. Verify: The Check command also checks if the given condition is true or false. Regardless of whether the condition is true or false, program execution is not interrupted, that is, any failure during the scan will not interrupt execution and all test steps will be performed.

10. What is an XPath?

XPath is used to find a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize, and transport arbitrary data. It stores the data in a key-value pair that is very similar to HTML tags. Both markup languages like those under the same umbrella, XPath can be used to find HTML items.

The key element behind the location of the elements using XPath is the scrolling of various elements along the page, so it allows the user finds an element with the reference of another element.

11. What is the difference between “/” and “XPath //”?

single bar “/”: the single bar is used to create XPath with an absolute path, ie the path will be created to start selecting from the Document / node start.Double “//” bar: The double bar is used to create the Xpath with a relative path, that is, the path will be created to begin selecting anywhere within the document.

12. What do we mean selenium selenium 1 and 2?

Selenium RC and WebDriver in a combination, popularly known as Selenium RC Selenium 2. The single is also known as 1.

13. Which is the latest Selenium tool?

WebDriver

14. How do I start the browser using WebDriver?

The following syntax can be used to start the browser: FirefoxDriver Driver WebDriver = new (); WebDriver = new ChromeDriver Controller (); WebDriver = new InternetExplorerDriver Controller ();

15. What are the different types of drivers available on Webdriver ?

Different drivers are available in WebDriver: FirefoxDriver

  1. InternetExplorerDriver
  2. ChromeDriver
  3. SafariDriver
  4. OperaDriver
  5. AndroidDriver
  6. IPhoneDriver
  7. HtmlUnitDriver

16. What are the Different Types of Waiting in the WebDriver?

There are two types available in the WebDriver to wait: Wait Implicit Explicit Wait Implicit Waiting: Implicit waits are used to provide a default timeout (eg 30 seconds) between each consecutive test step / command all the test script. Therefore, the next step only tests when 30 seconds have elapsed after executing the previous one. Expect Explicit Command / Pass Test: Explicit waits are used to stop execution until a particular condition or elapsed time expires. Unlike implicit waiting, explicit waiting only applies to a particular instance.

17. How to write in a text box using Selenium?

The user can use SendKeys (“String to enter”) to enter the string in the text. Box Syntax: User Name = drv.findElement WebElement (By.id (“e-mail”)) ); // enter the name usuariousername.sendKeys (“STH”)

18. How can we get text from a Web Part?

The Get command is used to retrieve the text from the specified internal Web Part. The command does not require parameters, but returns a string value. It is also one of the most used for checking command messages, labels, errors, etc. shown in web pages. Syntax: string text = driver.findElement (By.id (“Text”)). GetTexts ()

19. How to select a value from a drop-down?

menu value from the drop-down menu, you can be selected by using Select WebDriver.Sintaxis class: selectByValue: Select selectByValue = new Select (driver.findElement (By.id (“SelectID_One “))); selectByValue.selectByValue (“GreenValue”); selectByVisibleText: Select selectByVisibleText = new Select (driver.findElement (By.id (“SelectID_Two”))); selectByVisibleText.selectByVisibleText (“Lima”); selectByIndex: Select selectByIndex = new Select (driver.findElement (By.id (“SelectID_Three”))); selectByIndex.selectByIndex (2)

20. When we use findElement () and findElements () findElement ()?

findElement () is used to find the first item on the current Web page that matches the specified locator value. Note that only the first element will look coincident.Sintaxis: Item WebElement = driver.findElements (By.xpath (“// div [@ id=‘example’] // // ul li”)); findElements ():. findElements () is used to find all items in the current web page that correspond to the value of the specified locator note that all matching items will be searched and stored in the WebElements.Sintaxis list <WebElement> elementList = driver.findElements (By.xpath (“// div [@ id=‘example’] li // // ul”)).

21. selenium can handle pop-up windows based on selenium is a test tool?

Automation only supports web testing applications. so there are pop-up windows can be operated using Selenium.

22. How can we deal with web-based pop-up?

WebDriver provides users with a very efficient way of handling these windows emerging through the alert interface. There are four methods we would all use with Alert.void goodbye () method of dismissal (), click the “Cancel” button as soon as the popup.void accept () window: the accept () method click “OK” as the popup window. String getText () appears: the getText () method returns the text displayed in the SendKeys alert.void box (String stringtosend): the default SendKeys () method type string specified in the alert box. alert javascriptAlerta = driver.switchTo (). Alert (); alert.accept ();

23. How can we deal with pop-up windows based on?

Selenium is a test automation tool that only supports web testing applications, which means that the evidence does not support Windows-based applications. However, only selenium can not help the situation, but with some third-party interventions, this problem can be overcome. There are several third-party tools available to handle selenium-based pop-up windows like AutoIT, Robot class, etc..

24. How to enforce the title of the website?

// check the webassertTrue title page (“The window title is incorrect”, driver.getTitle () is the same (“Page Title”).

25. What is a framework?

The framework is a constructive combination of various orientations, coding standards, concepts, processes, practices, project hierarchies, modularity, information mechanism, test data injections, etc. test automation pillars.

26. What are the advantages of the automation structure?

The advantage of the test automation framework Code reuse Maximum coverage Recovery scenario Low cost maintenance Minimum manual intervention Easy reporting

27. What are the different types of frameworks?

The different types of frames are shown below:

Module-based test structure: The structure divides the entire “Application under test” into the number of isolated and logical modules. For each module, we create a separate, independent test script. So when these test scripts are considered together, a larger test script is created that represents more than one module: Library Architecture Test Framework: The basic logic behind the structure is to determine the common steps and group acting on a library and call these functions in the test scripts when necessary.Data Driven Testing Framework: Data Driven testing Framework helps the user to separate the test scripts and logical test data into each other.

It allows the user to store the test data in an external database. Data are conventionally stored in “key-value” pairs. Therefore the key can be used to access and complete data within test.Keyword scripts driven Testing Framework: The keyword-driven testing framework is an extension of the Data-Based Testing Framework in the sense that it not only separates Test the data of the scripts, but also hold the specific set of code that belongs to the test script in an external data file Hybrid test frame: The hybrid test frame is a combination of more than one of the frames mentioned above. The best of this configuration is that it leverages the benefits of all types of frameworks associated.Behavior Framework Driven Development: Structure Behavior Driven Development enables the automation of functional validations in an easily readable and understandable business format analysts, developers, testers, etc.

28. Can WebDriver test mobile applications?

WebDriver can not test mobile applications. WebDriver is a web-based testing tool, so applications in mobile browsers can be tested.

29. Can captcha be automated?

No, the captcha and the barcode reader can not be automated.

30. What is the object repository?

Object Repository is a term used to refer to the collection of web elements belonging to the Application Under Test (AUT) along with its location values. Therefore, whenever the element is required in the script, the finder value can be completed in the Object Store. The object repository is used to store localizers in a centralized place instead of encoding within the selenium scripts.En objects can be stored in an Excel spreadsheet that can be filled inside the script when it is all necessary. Now , I hope that in this article you will find answers to the most frequently asked questions about the Selenium interview and WebDriver. The answers provided here are also useful for understanding the basics of Selenium and the advanced themes of WebDriver.

31. What are some disadvantages of Selenium automation?

Selenium is a perfect clinical tool to embody the actions of users in a browser. However, it also has some limitations given below.No supports automation applications Windows No can do mobile automation for your account embedded.No a good story is 100% perfect for managing web elements dynamic processing challenges Place pop-ups or landmarks No so efficient to handle the page load Cannot automate captcha.

32. What programming languages does Selenium use?

Selenium Webdriver supports the following programming languages:

  • Java
  • C-Sharp
  • JavaScript
  • Ruby
  • PHP
  • Perl

33. What / supported operating system platforms Selenium?

Below is a list of operating systems / platforms that supports Selenium OS.

Windows Windows
Mobile Linux Mac
XIOS Android

34. What types of cases can be automated with Selenium?

We can use selenium to automate the following types of test cases. Functional cascades Regression tests Acceptance test test Casos cordura Soft test tests End-to-end tests Cross tests Integration tests Sensitive browser keys

35. Can you use Selenium to test the Rest API or Web services?

Selenium provides native APIs for interacting with the browser through actions and events. Rest API and Web services have no interface

36. What are the different types of web controller APIs supported in Selenium?

The following are the Web drivers supported in Selenium.

Name WebDriver | WebDriver API | Browser compatible | Gecko driver (also known as Marinetto) | FirefoxDriver () | FirefoxMicrosoft WebDriver (a.k.a. Edge) | InternetExplorerDriver () | Google Chrome Controller is said | ChromeDriver () | HTML Chrome Driver Drive | Web Client () | {Chrome, FF, IE} Driver OperaChromium | ChromeDriver () | OperaSafari Driver | SafariDriver () | Android Safari Driver, AndroidDriver () | IOS Browser AndroidDriver | IOSDriver () | IosEventFiringWebDriver Browser | EventFiringWebDriver () | ALL

37. What do you know about Selenium IDE?

Selenium IDE is a popular Firefox extension. It presents a graphical interface to record, reproduce and save the actions of the users. Beginners in test automation may find it convenient to test the Web automation. After recording a workflow, we can also export the steps in various formats: Shinya Kasatani was the developer who created the Selenium IDE. The idea flashed through him as he searched the JavaScript code inside the Selenium kernel. So he made a proof of concept and developed it into a complete IDE.

38. What do you know about Selenese?

Selenium IDE has a built-in linguistic system known as Selenese. It is a collection of Selenium commands to perform actions on a Web page. For example, it can detect broken links on a page, check for the presence of a Web element, Ajax alerts, JavaScript, and more. There are basically three types of commands in Selenese: Actions: You can change the state of an application. For example, you are clicking a link, selecting a value from the drop-down menu, etc.Accessors: These commands monitor the status of an application and cache it in some variable. For example, storeTextPresent, storeElementPresent, etc.Acknowledgements: These commands allow you to add a checkpoint or checkpoint. They confirm the current status of a UI element.

39. What You Know About Selenium Grid?

Selenium Grid is a tool that can distribute tests across multiple browsers or different machines. Allows parallel running of test cases. Using this, we can configure to run thousands of test cases simultaneously on separate devices or browsers.

40. What is the reason to use the selenium grid?

Selenium Grid allows test cases to run across multiple platforms and browsers simultaneously and therefore supports distributed testing. This ability to parallelize the tests is what makes us use the selenium grid.

41.What does a concentrator do in the selenium network?

A concentrator is analogous to a server that controls the execution of parallel tests on different machines.

42.What does a knot do on the selenium grid?

The machine we register in a hub represents a node. The registry allows the grid to retrieve the node configuration and run the tests. There may be several nodes that we can join in a Selenium grid.

43. What is the command to connect a node to the selenium grid?

Be sure to download the Selenium server jar before running the following command.java -jar <selenium-server-standalone-x.xx.x.jar> – node function -hub http: // <IP node> : 4444

44. What is the difference between MaxSessions vs. Selenium grid MaxInstances properties?

Sometimes we get confused by differentiating between MaxSessions and MaxInstances. Let’s understand the difference clearly.
1. MaxInstances: It’s no. of browser instances (of the same versions) that can be run on the remote machine. Check the following commands. BrowserName = firefox-browser, version = 59, MaxInstances = 3 = WINDOWS-browser platform browserName = InternetExplorer, version = 11, MaxInstances = 3 = WINDOWSEsto platform means you can run three instances of Firefox and IE for the same time. Therefore, a total of six different browsers (FF and IE) can be executed in parallel.
2. MaxSession: Determines how many browsers (regardless of type and version) can run simultaneously on the remote machine. Exceeds the setting of “MaxInstances”.
In the example above, if the value of “maxSession” is one, then it will not run more than one browser. As long as the value two, any of these combinations (2ff, 2iE, 1FF + 1IE) is performed at time.

45. Which of the selector ID, name, XPath or CSS should I use?

If the site has unique names or identifiers available, then we use them. If they are not available, go to a CSS selector because it is faster than XPath. When none of the preferred locators are present, you can try XPath.

46. is XPath? How does it work?

XPath is the most commonly used localization strategy that uses Selenium to find web items. It works to navigate through DOM elements and attributes to locate the target object. For example, a text box or a button or checkboxes, while guaranteeing the item you are taking care of. But it is slower than compared to other localizers, such as IDs, names, or CSS.

47. What does a single “/” bar in XPath do?

The only bar (below) “/” represents the absolute path. In this case, the XPath engine navigates the DOM of the first node.

48. How is a statement different from verification?

Affirm: it allows us to check the result of an expression or an operation. If the “statement” fails, then abort the test operation and continue with the next case.
Verify: It also works as the statement. However, if the “scan” fails, it will not stop the test and continue to the next step.

49. What difference do you make between soft vs. Hard to say in selenium?

Soft Assert: adds the errors that occurred while running the test. If this statement fails, control jumps to the next step.
Hard Assert: responds immediately with an AssertException and breaks the current test. Thereafter, the following case is executed in the sequence.

50. What is the command to insert text into the HTML text box using Selenium?

can do using the SendKeys () method .
WebDriver FirefoxDriver WebDriver = new (); webdriver.get (“https://www.google.com”)
webdriver.findElement (By.xpath (“<< xpath expr >>”)). sendKeys (“Selenium interview questions”);

51. How to enter text in the HTML text box without invoking the SendKeys ()?

Selenium JavascriptExecutor There is a class that provides methods to perform actions on the HTML object elements.

// Set JSJavascriptExecutor jscript = (JavaScriptExecutor) WebDriver; // Issue the command to insert the text.jscript.executeScript (“document.getElementById (‘textbox’). Value = ‘Some text’;”);

52. How to use frame elements in Selenium on a page?

Manipulate the frame and its contents you should change it from the beginning. Similar task as we used to change to a different page before interacting with it: driver.switchTo () .frame (index) Here the index is the zero-based index of the table. When you change the frame, they are directed to the following interactions through the controller to the selected frame. The structure method works under the name, element ID, and reference to already-found elements. To return to the default frame, use the defaultContent.driver.switchTo () method. defaultContent ();

53. What are the different components of the selenium?

suite package that consists of the following toolkits: Selenium Integrated Development Environment (IDE) is a Firefox addon that can be easily installed along with other add-ons. Since it has a simple framework, the Selenium IDE should be used as a prototyping tool. For advanced use cases,

Selenium RC or WebDriver would be suitable: Selenium Remote Control (RC): is a test framework that allows developers to write code in any programming language. Usually it is compatible with a wide range of languages like Java, PHP, Python, Perl, C #, etc.Selenium WebDriver: This tool has more advanced RC and IDE features. A better approach is applied to automate your browser activities.

Selenium Grid: works with Selenium RC and runs tests on different nodes using different standard browsers simultaneously. Selenium does not offer the object repository, but we can create the object repository in Selenium Driver Web. See this tutorial to learn more about Selenium.

54. What test can selenium perform?

Selenium can be used for the functional, regression and load test of the web-based application. The automation tool can be deployed for post-launch validation with continuous integration tools such as Jenkins, Hudson, QuickBuild, or cruiseControl.

55. How to use frame elements in Selenium on a page?

Manipulate the frame and its contents you should change it from the beginning. Similar task as we used to change to a different page before interacting with it: driver.switchTo () .frame (index) Here the index is the zero-based index of the table. When you change the frame, they are directed to the following interactions through the controller to the selected frame. The structure method works under the name, element ID, and reference to already-found elements. To return to the default frame, use the defaultContent.driver.switchTo () method. defaultContent ();

56. What are the different Selenium components?

The suite package constitutes of the following sets of tools :
Selenium Integrated Development Environment (IDE) is a Firefox addon that can be easily installed along with other add-ons. Since it has a simple framework, the Selenium IDE should be used as a prototyping tool. For advanced use cases, Selenium RC or WebDriver would be suitable:

Selenium Remote Control (RC): is a test framework that allows developers to write code in any programming language. It is generally compatible with a wide range of languages like Java, PHP, Python, Perl, C #, etc.

Selenium WebDriver: This tool has more advanced features than RC and IDE. A better approach is applied to automate your browser activities.

Selenium Grid: works with Selenium RC and runs tests on different nodes using different standard browsers simultaneously. Selenium does not offer the object repository, but we can create the object repository in Selenium Driver See this tutorial to learn more about Selenium.

57. What test can selenium perform?

Selenium can be used for the functional, regression and load test of the web-based application. The automation tool can be deployed for post-launch validation with continuous integration tools such as Jenkins, Hudson, QuickBuild, or cruiseControl.

58. What are driver.close and driver.quit in WebDriver? Which is more preferable?

These are two different methods used to close the browser session in Selenium.

driver.close – To close the browser window on which the focus is set.
driver.quit – To call the driver.dispose method that closes all the browser windows and ends the WebDriver session gracefully.
Know more about training course on Selenium to improve your web testing skills.

59. What differs the configuration of Selenium Selenium 2.0 1.0?

For Selenium 1.0, we need a jar file that belongs to a Selenium library, eg in the case of Java, you need a Java client driver also a Selenium.

60. Can you run the tests registered with Selenium IDE in other browsers?

Although Selenium IDE is a Firefox, however, it is created tests can also be run on other browsers using Selenium RC (Selenium Remote Control) and specifying the test set name online comandos.for example, by the command line
c : \ Program Files \ Mozilla Firefox \ firefox.exe “-chrome” chrome: //selenium-ide/content/selenium/TestRunner.html? baseURL = http: // localhost & test = file: /// C: \ test \ TestSuite.html & auto = false “With javac program: \ Program Files (x86) \ Java \ jre6 \ bin \ java.exe” – jar c: \ seltest \ selenium-server-standalone-2.18.0.jar -htmlSuite “* firefox” “http: //127.0 0.1” “c: \ seltest \ mytestsuite.html.” “c: \ seltest \ logs \ results-firefox.html “-port 555561.

61. How we handle pop-up web-based ?

Below are four methods you can use along with the alert interface: void dismisses (): the acceptance () method clicks () method: accept (): the accept () method clicks the “Ok” button, the default SendKeys () method acknowledged: “when the popup window. getText () appears: the getText () method returns the text displayed in the box alerta.void SendKeys (stringtosend string) syntax specified in the alert box: // accepting the alert javascript alert alert = driver.switchTo () alert (); alert. .accept (); Click here for more information about the online training certification AJAX pop-up window handle the Selenium.

62. How to handle the AJAX popup window?

By using getWindowHandles () and obj.switchTo.window (WindowID), a developer manages windows pop-up using explicit wait commands and driver.swtchTo.window (“name”) for your requirements.

63. What are the performance testing tools?

Some popular commercial test tools are: LoadRunner (HP): This testing tool contains a wide variety of application environments, platforms, and databases. It is usually appropriate for the Web and otros.
QAload Applications (Compuware): This tool is used for load testing of web database systems, and based on char.
WebLoad (RadView): used to compare the execution of tests with metrics prueba.Rational Performance Tester (IBM) to discover the presence and cause of bottlenecks. Silk Performer (Borland): This testing tool allows predicting the behavior of the e-business environment.

64. What is Selenium IDE?

Selenium IDE is a supplement that is used to record and play the tests in the Firefox browser. Scripts can be automatically recorded and edited manually, which supports automatic completion and the ability to move commands quickly.

65.What is Selenese?

Selenese is the language used to write test scripts in Selenium IDE.

66. What types of tests are compatible with Selenium?

Functional Tests Regression TestSanity TestingSmoke TestingResponsive TestingCross Browser Testing Testing (integration) Integration tests are compatible with Selenium.

67. What are the different types of locators in Selenium?

The different types of locators in Selenium are ID, NameName, Name, TagName, LinkText, PartialLinkText, XPath, CSS Selector, DOM.

68. Which automation tools can be used for post-launch validation with continuous integration?

Automation tools can be used for post-launch validation with continuous integration: CruiseCont, Hudson, Jenkins, Quick Build.

69. Explain the meaning of the statement in Selenium and what are the types of assertion?

Assertion is used as checkpoint. Verify that the application state is up to expectations. The assertion types are “affirm”, “verify” and “waifFor”.

70. Explain the difference between confirming and verifying commands?

Both check whether the given condition is true or false. Contrary to “assert”, “verify” will not interrupt the execution of the test case if the test case fails

71. How can it be found if an item is displayed on the screen?

There are different methods that help the user check the visibility of web elements: isDisplayed (), isEnabled (), isSelected (). These web elements can be buttons, mailboxes, checkboxes, radio buttons, labels, etc.

72. What is the difference between the “type” and “typeAndWait” commands?

If you need to enter the keyboard key values in a text field of the web application, the “type” command will be used. Another reason for its use is the selection of values in the combo box. The “typeAndWait” command is used when writing is completed and the software webpage begins to reload.

73. How can the user get a text from a web element?

The user can retrieve the text of the web element specified by the get command. It does not require any parameters, but returns a string value.copyString Text = driver.findElement (By.id (“Some Text”)). GetText () is an example of this. How can you delete a text written in a text field? Text written in a text field can be deleted with the clear () .

74. How to check a Selenium checkbox?

The same click () method can be used to mark the check box as well as clicking the buttons or radio buttons.