Automation testing, also known as Test Automation, is the process of automating manual testing of an application or system using tools that allow you to create a selenium script that can repeatedly be executed and generate detailed test reports.
The following are some of the advantages of automated testing types:
- It allows for both performance and functional testing of a system or application.
- It allows for repeated testing.
- It allows the parallel execution of test cases.
- This reduces the need for humans to create test cases and improves the system's accuracy and efficiency.
- It is used for regression testing.
- It is useful in the testing of large-scale test matrixes.
- This saves time and money for all the testers involved in the project.
6. What are the benefits of Selenium as an Automation Tool?
Here are some of the benefits of Selenium for automated testing:
- Open Source: Selenium is a freeware and a portable tool. There are no extra costs. You can download the utility for free for the user base. Community-based assistance is also available.
- Language assistance: Java and Perl, Python, C# Ruby, Ruby, Groovy, and JavaScript are all supported by Selenium. It is independent of any script and has no limitations. It can be used with many languages depending on the preferences of developers and testers.
- Compatible with a variety of operating systems: Selenium can be used on a number of operating systems including Windows, Mac OS X, and Linux. Selenium Suite of Products allows you to create a customized testing suite on any platform. Then, you can execute it on another platform. You can write test cases in Windows, and then run them on Linux.
- Browser compatibility. Selenium works with many web browsers including Internet Explorer, Chrome Firefox, Opera, Safari, Opera, Safari, Opera, Safari, Opera, Firefox, Opera, and Safari. This is very useful when you run tests and test them across multiple browsers simultaneously.
- Framework support and programming languages: Selenium can be used with many programming languages and frameworks. It can integrate with ANT and Maven frameworks to compile source code. It can also be used to test applications and generate reports with the TestNG framework. Continuous Integration (CI) can be integrated with Hudson or Jenkins, and can also integrate with other open-source tools to provide additional functionalities.
- Testing on various devices: For Android, iPhone, and Blackberry users, Selenium test automation can be used to automate the testing of mobile web applications. This will allow for the creation of the necessary results as well as the continual resolution of bugs in the application.
- Selenium support is based on a community that allows for regular updates and upgrades. These upgrades are easy to install and do not require any special training. Selenium is therefore both cost-effective and resourceful.
- Selenium Suites with lots of content: Selenium can be more than a tool or utility. It's a complete set of many testing tools, which is why it's called a "Suite". Each tool can be tailored to meet specific testing requirements and test environment constraints. Selenium includes Selenium IDE and Selenium Grid as well as Selenium Remote Control (RC).
- It's easy to implement: Selenium offers a user-friendly interface, making it simple to create and run tests. Open-source features allow users to write their own extensions. This makes it easy to modify actions and manipulate them to a high degree. Selenium's reporting capabilities are another reason for its popularity. They allow testers to extract data and take actions based on it.
7. What are the drawbacks to using Selenium for testing?
These are the drawbacks of using Selenium for testing:
- Tests web apps only: Selenium allows the testing only of web-based applications. Selenium cannot test mobile applications, Captcha, and Barcode readers unless they are integrated with third-party tools such as Appium or TestNG.
- Selenium does not have a built-in reporting or test management facility. Selenium can only generate reports using third-party tools such as TestNG and JUnit.
- Inability to provide reliable tech support: Selenium is an open-source tool. This means that there is no support available for users with specific issues.
- may require knowledge of programming languages. Selenium requires some programming knowledge.
8. Why should Selenium not be used as a web application or system testing tool?
Selenium has the following benefits, making it an excellent automation testing tool:
- It is open-source and free software. There are many users and a community that supports it.
- It supports cross-browser compatibility with multiple browsers, including Google Chrome, Mozilla Firefox, and Internet Explorer.
- It supports many operating systems, including Windows, Linux, and macOS.
- It allows you to use multiple programming languages, including Scala, Ruby and Python, PHP, Perl Java, Groovy, C#, and others.
- It also supports distributed testing
9. Is it possible to use selenium to launch web browsers
Yes, Selenium supports web browsers such as Google Chrome, Mozilla Firefox, and Internet Explorer.
These commands will launch web browsers with Selenium.
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();
10. What does Selenese mean? Describe the different types of Selenium commands.
Selenese is the language and Selenium IDE which uses to write test scripts. It's a collection of commands that you use to test your web app or system. The three main categories of Selenium commands:
- Actions These commands allow you to interact directly with web applications.
- Accessors These commands allow users to store values in a user-defined variable.
- Assertions These allow you to compare the current state and the expected state of your application.
11. What does it mean to be a locator? Name a few types of locators found in Selenium.
A locator is a unique address that uniquely identifies web elements within a webpage. Selenium has a variety of locators that can uniquely identify web elements.
- ID
- ClassName
- Name
- TagName
- LinkText
- PartialLinkText
- Xpath
- CSS Selector
- DOM.
12. Identify the main difference between "assert", and "verify" commands within Selenium.
Both the "assert” and "verify commands. It verifies whether the condition is true or false. The only difference is:
- Assert: Assert conditions that stop the execution of the tests if they are false. Otherwise, the tests would continue.
- Verify that the condition does not stop the execution, regardless of whether it is true or false.
13. What does an exception test in Selenium mean?
An exception test is a test that expects an exception to be thrown within a test class. It expects @Test annotations to be followed by the expected exception name within the brackets.
Eg: @Test(expectedException = NoSuchElementException.class)
It is an exceptional test for missing elements in Selenium.
14. What does XPath mean in Selenium? Describe XPath Absolute & XPath Relation.
XPath is also known as XML Path (Extensible Markup Language Path) and is a language that queries XML documents. It provides functionalities such as the ability to locate elements in Selenium, iterating through every element on a webpage. XPath stores data in a key/value pair format, similar to an HTML tag. It uses one slash (i.e. It uses a single slash to create an absolute path and a double one to indicate that it is. //'to create a relative path that allows an element to be found on a webpage.
15. What is the difference in Xpath between "/"? and ""?
Single Slash - This is used to create an absolute path Xpath. The document/start node will be the XPath's starting point.
Take, for example:
Absolute XPath: /html/body/div/div/form/input
Here, /HTML refers to the root HTML node.
Double Slash – The double slash can be used to create an Xpath using a relative path. This allows the XPath to start selection from any page.
Take, for example:
Relative Path: //input[@id='email']
This will locate any input with id = email that is found in the document object modeling (DOM).
16. What is the difference between "type" and the "typeAndWait" commands within Selenium?
To enter keyboard keys into a text box in a software web app's software web application, use the "type" command. You can also use it to select values from a combo box. The "typeAndWait” command is used when the software web page starts to reload after you have finished typing. This command will wait until the page of the program reloads before it can proceed. If there is no page refresh event, you will need to use the basic "type" command.
17. Distinguish between findElement() & findElements() in context of Selenium.
The following table shows the differences between findElement() in Selenium and findElements().
findElement() | findElements() |
---|---|
Return the first element on the web that matches the locator. | It will give you a list of all web items that match your locator. |
A NoSuchElementException is produced if there are no matching web elements. | An empty list will be returned if there aren't any matching elements. |
Syntax - WebElement button = webdriver.findElement(By.name("< >")); |
Syntax - Liste buttons = webdriver.findElements(By.name("< >")); |
18. How long will Selenium wait before a website is loaded fully?
Two methods can be used to ensure that the website has been fully loaded in Selenium.
These are the details:
1. Set an implicit wait immediately after you have created the web driver instance
temp = driver.Manage().Timeouts().ImplicitWait;
This will wait for the page to load before it navigates or reloads.
2. JavaScript returns document.readyState until "complete" is returned following page navigation. The web driver instance is available to JavaScript executors.
Code example:
new WebDriverWait(firefoxDriver, pageLoadTimeout).until( webDriver ->
((JavascriptExecutor) webDriver).executeScript("returndocument.readyState").equals("complete"));
19. What is the difference between the driver.close() and driver.quit() commands in Selenium
The main difference between the commands is as follows:
driver.close()
closes the currently active window that the user is currently using or the window currently accessed via the web driver. The current window can be closed by this command.driver.quit()
Command, unlike thedrivers.close()
Command closes all windows that have been opened by the program.
Both commands don't accept any parameters and don't return any values.
20. Describe the different navigation commands that Selenium supports?
Selenium supports four major types of navigation commands :
navigate().back()
This command takes the user to the most recent page in the browser history.navigate().forward()
: This command is used for taking the user to the next web page of the browser history.navigate().refresh()
: Used for reloading the web components of a webpage by refreshing it.navigate().to()
: This command allows you to navigate to a specific URL using a new browser. As a parameter, it takes the URL to be moved to.
21. What is Selenium's approach to the same-origin policy?
Same Origin policy is a security feature that allows web browsers to run scripts from one website to access the contents on another webpage, provided the origins of both pages are the same. The origin is the URL scheme, hostname, and port number combination. This policy was established to prevent ill-intentional access to sensitive data from one website to another. Scaler.com uses a Java program to access pages such as scaler.com/mentors and scaler.com/courses. However, it cannot access other domains like facebook.com.
The Selenium Server (SeleniumRC) is a client-configured HTTP proxy that tricks the browser into thinking Selenium Core or the web application being tested are from the same source.
22. Explain the difference between findElement() in Selenium and findElements().
The and commands have two major differences.
1. FindElement()
is used to find a specific element on a webpage. It is also used to return the object of the first element found by the locator. Eg:
WebElement element = driver.findElement(By.id(example));
2. findElements()
is a command that finds all elements on a webpage specified by the locator. This command returns a list of all elements that match the specified locator value. Eg:
Liste elementList = driver.findElements(By.id(example));
23. Explain the pause function in SeleniumIDE.
The pause feature allows the user to pause at the exception in the test script and then enter debug mode by clicking the pause icon at the top right corner. This feature prevents the test case from failing and allows the user to immediately correct the error.
24. Explain the differences between different frameworks and how they are connected to Selenium's Robot Framework.
These are the various types of frameworks available:
- Behavior-Driven Development Framework This framework is readable and easy to understand for Business Analysts, Developers, and Testers.
- Data-Driven Testing FrameworkThis framework allows you to separate the test data and the test-script logic. It stores test data in an external database using key-value pairs. These keys can be used to access and populate data into test scripts.
- Keyword-Driven Test Framework: This framework is an extension to the data-driven test framework. It not only separates test data from test-script logic but also stores a portion of test script code in an external file.
- Library Architecture Testing Framework This type of framework breaks down common steps into functions that are part of a library and then calls those functions when needed.
- Module Based Testing Framework: This framework breaks down each test application into multiple isolated and logically distinct modules. Each module has its own test script.
- Hybrid Testing Framework This type of hybrid framework combines all the best features of the frameworks mentioned above.
- The data-Driven framework generates external files like XML, CSV. Data-driven framework in selenium to separate a dataset from the actual test case.
- Robot Framework is an open-source modular automation framework that can interact with third-party libraries and functions. Robot Framework provides a test automation runner, or an automation wrapper, to execute Selenium's web testing library. MSTest and TestNG are popular alternatives that serve the same purpose.
25. What are your thoughts on the Page Object Model within the context of Selenium What are its benefits?
Page Object Model (POM), a design pattern that generates Object Repository for web UI components, is popularly used in test automation. This paradigm reduces code duplication and improves test maintenance. This paradigm requires that each web page within the application have its own Page class. This Page class will identify each web page's WebElements. It also contains Page methods that can operate on these WebElements. The names of these methods should correspond to the tasks they perform, for example, if a loader is waiting for the payment gateway to appear, the POM method name could be waitForPaymentScreenDisplay()
.
The Page Object Model (POM), has the following advantages:
- The Page Object Design Pattern states that user interface activities and flows must be kept separate from verification. This idea makes our code clearer and more comprehensible.
- Another advantage is the fact that the object repository can be used independently of test cases. This allows us to reuse the same repository with different tools. Selenium can be used to combine Page Object Model and TestNG/JUnit in functional testing, and JBehave/Cucumber in acceptability testing.
- The reusable page methods within the POM classes make code less efficient.
- Methods are given realistic names so that they can be associated with the UI operation. After clicking the button, we will land on the homepage. The function name is 'goto homepage()'.
26. What are your thoughts on Jenkins? What are the benefits of using Jenkins with Selenium
Hudson Lab's Jenkins continuous integration technology is the most widely used open-source. It is cross-platform so it can be used on Windows, Linux, and Mac OS. Jenkins is a Java program. Jenkin is a Java application that keeps track of all jobs such as SVN checkouts, cron jobs, or application states. Pre-configured actions are activated when a certain event occurs in an application.
These features are available in Jenkins.
- Jenkins creates a list of changes made to SVN repositories.
- Jenkins provides permanent links to the most current build or failed build. This can be used for easy communication.
- Jenkins is easy to install via either an executable file (exe), or a war file that can be deployed via the application server.
- Jenkins can be configured to send the contents of the build status to an address via email.
- Jenkins is simple to configure multiple windows in selenium.
- Jenkins can be configured so that it will run an automated TestNg build after every SVN build.
- Jenkins records the details of each jar, its version, and the mappings of build and number.
- Jenkins can be configured to use plugins and other functionality that are provided by third-party plug-ins.
Here are some reasons why we use Jenkins and Selenium:
- Selenium tests can be run in Jenkins every time your program is modified. If the tests pass you may deploy the software into a new environment.
- Jenkins could execute your tests at a predetermined moment.
- You can save both the execution history and Test Reports.
- Jenkins lets you develop and test projects in continuous integration with Maven.
27. What are the parameters that selenium commands come with a minimum?
There are four tests to be passed to be able to pass Selenium. They are as follows:
- Host
We can connect the Selenium to an IP address that is specific instead of a local host on the local computer.
- Port Number
You can also select the port number as well, i.e. TCP/IP port that connects to the Selenium test with the Grid hub. Grid hub. It is important to ensure that there isn't another application that has a similar port code in another location on this machine.
- Browser
The browser where selenium scripts are executed.
- URL
The URL of the application triggers tests within that.
28. How can you tell the differences in the Absolute pathway as well as Relative Path?
Absolute Path:
- The path begins at the root node and finishes at the desired element node.
- It begins with the single Slash (/)
- Example: /html.body/div/td/input
Relative Path:
- The path can be started from any node between and ends at the element node you want to connect to.
- It begins with an apostrophe and double slash (//)
- Example: //input/example[@id=name]
29. What's the distinction in Assert or Verify declarations within Selenium?
Assert:
- It is possible to determine if an element is present on the page or not.
- The test fails, and it is ended when there is a failure of the test. The program control flow ceases.
Verify:
- It's only about stating the condition that is true or not.
- The program control flow will not cease due to this.
Overall The Verify statement doesn't stop the program's execution, but the Assert statement stops the execution.
30. What are the points of verification that are in Selenium?
- Selenium IDE: Check and apply commands
- Selenium Web Driver It does not provide built-in features to assist with verification, and it is dependent on the style of coding we use. A few examples include looking up the page's title or specific texts on the page, or checking for specific elements like dropdown, textbox field, and so on.,
31. Define Implicit wait, Explicit wait, and Fluent
There are three different types of waits, they are explicit waits, implicit waits, fluent waits.
- Implicit Wait:
You can specify the timeout period for an exact period of time for each of the subsequent web elements. Before throwing the NoSuchElementException in this specified time, the web driver searches for all the web elements.
- Explicate Wait:
Web Driver can wait for certain conditions before throwing the ElemntNotVisibleException.
- Fluent Wait:
It's a slight increase for the waiting time that's explicit. Apart from waiting, we can take actions action, set the frequency with which we check the condition before throwing the ElementNotVisibleException.
32. Can Selenium manage windows-based pop-ups?
As we know, Selenium can be described as an automated tool for testing which can only work with web-based applications. So, pop-ups in windows can't be controlled by Selenium. But, by integrating third-party tools, we can solve this issue.
33. What's the definition of an Object Repository and explain how we can build the Object Repository within Selenium?
The web element collection is associated with the test application and its values for the locator. It is also known by the name of Object Repository. The only difference is that the locators are kept in a central location rather instead of hard-coding them into testing scripts.
In the process of integrating Selenium, the data are stored in Excel in addition and utilized to populate them into the script when needed.
34. What is the main difference between obtainwindowhandle() as well as the getwindowhandles ()?
getwindowhandles() getwindowhandles(): This function is used to find addresses of each open browser, and return the type of data of Set.
getwindowhandle() getwindowhandle(): This method is used to find an address for the browser window that it's focusing on, and return the String data type.
35. What are the various types of Annotations that are used in Selenium?
Syntactic metadata is added to Java source code. This is also known as annotations. These can appear in packages, variables, parameters classes, variables, and more. Some of them that are employed to create Selenium include,
@Before, @Test, @After
36. What is the main difference in the setsSpeed() or sleep() methods?
The difference between setSpeed() or sleep() method is that this will slow down the time of execution.
Thread.sleep(): The thread in question will cease to run for a specific amount of time. It will wait until the command is entered. It only requires a single argument, which is in the format of Integer.
Set sleep(): This command stops the execution of every selenium-related command. This command is only used to demonstrate the use of selenium and for slow web applications.
37. What is the way to retrieve the alert message? the box alert or alert box be found?
The storeAlert() command is used to get the alert message from the pop-up, and then store it in an undefined variable. It is called an alert box too.
38. How do you determine the exact location of an element on the web?
verifyElementPositionLeft and verifyElementPositionTop commands are used. They work by using pixels comparison to determine the location of the element from the left and the top of the page, respectively.
39. Why do we use Selenium RC?
- Selenium IDE has the limitations of selenium that Selenium RC can diminish in terms of browser support as well as language support.
- IDE is not able to provide many functions such as logging, iterations and tests, conditional statements reports on results, and so on. It does not support HTML Language.
- This is why Selenium RC is used to communicate with other languages such as Perl, Python, etc.,
40. What are the benefits or advantages of Selenium RC?
The advantages or benefits that come from RC include,
- The data can read write to or .xlsx, .csv, .txt etc.,
- Dynamic objects, as well as Ajax-related UI elements, are able to be handled.
- Iterations and conditional statements are a great way to improve performance and flexibility.
- Support for all programming languages and operating systems.
- Selenium can be used with any browser that is compatible with Javascript.
41. Do you have a list of the technical limitations when making use of Selenium RC? Selenium RC?
- Same-origin policy
- Anything that is not in the browser's scope is also restricted to the execution of the test scenario.
42. What's the reason to utilize the TestNG together with Selenium What is the reason to use RC with Selenium?
If the automation testing suite is compatible with various client and server platforms then we must run the test cases using commands. We also require reports on test results regularly to estimate the results and to also allow the ability to design the tests. This kind of flexibility is offered by TestNG.
43. What Language do you prefer to use to build test case sets in Selenium?
The most popular programming language for Selenium would be Python instead of Java. This is due to the fact that,
- Java programs run slower than Python software.
- The way to implement and the level of complexity are different, but Python is a great choice.
- Python can be dynamically typed, whereas Java can be statically typed.
- Java isn't as simple or easy to write test cases in comparison to Python.
44. What are Start and Breakpoints? in Selenium?
- Breakpoints
The execution flow is stopped with the breakpoints. This way we can check if the code is operating in the correct way or not.
- Starting points
The location from which the execution will be able to begin is determined by the starting point. If you are planning to run an experiment starting from the middle of the code, or breaking point, you can use these.
45. What is the purpose of this capability? relevant in relation to Selenium?
Key-value pairs are used to store information such as the name of the browser as well as the version of the browser and the path of the driver of the browser within the system and so on. This information is used to analyze the behavior of the browser is during the time of its execution. This function or feature is often called the desired capability.
For Selenium,
The driver instance is set up using this method.
It's a good idea to do this when you need to test the scenarios on different Operating systems as well as browsers and versions.
46. When do you use AutoIT?
We know that Selenium is used to automate web-based applications. However, if we wish to control or manage or maintain the GUI, HTML pop-ups, then we require AutoIT, robot class.
47. Do you have a reason why you require Session management in Selenium?
Session handling is crucial when working using Selenium. This is because when working with test case scenarios, we need to establish the connection with the web browser when performing the commands. There is a possibility that while running a certain test script, a different test script could be executed on the same host, and the same kind of browser. That is perhaps the most critical aspect and is the reason we require session handling.
48. Are you able to automatize CAPTCHA?
The answer is no. We are unable to automate CAPTCHA using Selenium. The idea behind CAPTCHA is to make sure that automated test scripts don't have access to sensitive data which is the reason why we can't automatize the process. The captcha needs to be entered manually in order to ensure smooth testing.
49. How can we launch various browsers on Selenium?
- A driver instance needs to be developed for a specific browser that we have to work on.
- WebDriver driver = new FireFoxDriver();
- WebDriver driver = new ChromeDriver();
- The selenium WebDriver is the user interface through which the Firefox Chrome, Firefox, and another driver for browsers implementations are created.
- Not compatible to test Desktop applications.
- WebDriver's Select class's values of the dropdown can be selected by this.
50. Why should you select Selenium rather than QTP (Quick Test Professional)?
Feature | Selenium | Quick Test Professional (QTP) |
Browser Compatibility | Most well-known browsers are supported. Firefox, Chrome, Safari, Internet Explorer, Edge, etc. | This only supports Chrome, Firefox, and Internet Explorer. Additionally, it only supports Windows. Windows operating system. |
Distribution | It is open-source and is free to download. | Distributed as a license-based tool and commercialized. |
Application Under Test (AUT) | Web-based applications can only be used by this type of test automation. | This supports web-based applications as well as windows-based software to automate testing. |
Object Repository | Selenium is a separate entity. Selenium serves to build the repository for objects. | The automatic creation and creation process of the Object repository occurs and is also maintained. |
Language Support | Multiple programming languages such as Java, Python, Perl, Ruby, C#, and many more. All of them are supported by Selenium. | Only the VBScript software is used by the QTP. |
Vendor Support | We already know that Selenium is a tool that is free and we don't receive vendor support when trying to solve the issues we encounter. | Support for vendors is provided to those using QTP and they get rapid responses because QTP is licensed and commercially licensed. |
Summing up...
In conclusion, the Reading theory is not the only part you need to check how selenium actually works. Test your knowledge by taking quizzes, making projects.
Learning Java can help you crack any Selenium Interview. So go through the following article and documentation to gain more knowledge. Interviewers expect a good knowledge of Java or Python.
You might also be interested in reading:
- Difference Between Scripting And Programming Language | Why Scripting Language Is Considered A Programming Language But Not Vice-Versa?
- An Overview Of The Assembly Language
- What Is C Programming? Know The History, Basics, And Importance
- Encryption Vs. Decryption | Know How Your Data Is Protected On Internet
Comments
Add comment