YouTube Icon

Interview Questions.

Top Selenium Interview Questions and Answers - Dec 29, 2020

fluid

Top Selenium Interview Questions and Answers

Selenium is an open-source apparatus utilized for Automation Testing, which permits you to test web applications across a scope of programs. It was acquainted once Manual Testing began with represent a few difficulties, and there was a popularity for a strategy that mechanizes the testing cycle. This Selenium Interview Questions blog has an arranged rundown of a large portion of the inquiries that are posed during Selenium prospective employee meetings. These Selenium inquiries questions are referenced underneath: 

Q1. What is Automation Testing? 

Q2. Is Selenium 2.0 not quite the same as Selenium 3.0? Assuming this is the case, how? 

Q3. Notice a portion of the mainstream apparatuses utilized for Automation Testing. 

Q4. What is Locator? By what method will you find a component in Selenium? 

Q5. What are the test types upheld by Selenium? 

Q6. What is XPath? 

Q7. Clarify the contrast between Single slice and Double cut in XPath. 

Q8. For what reason would it be advisable for me to utilize Selenium for test computerization? 

Q9. Does Selenium have any specialized constraints? Provided that this is true, what are those impediments? 

Q10. What is an item store? 

1. What is Automation Testing? 

Mechanization testing is the way toward computerizing the manual testing of the application under test (AUT) or the framework under test (SUT). It incorporates the association of testing apparatuses that assist us with making test contents, which can be utilized more than once with no human mediation. 

2. Is Selenium 2.0 not quite the same as Selenium 3.0? Assuming this is the case, how? 

Selenium RC is called Selenium 2.0, and the combination of Selenium RC and WebDriver as a solitary apparatus has framed Selenium 3.0. 

3. Notice a portion of the well known devices utilized for Automation Testing. 

Selenium 

Sound Robot 

HP Unified Functional Testing (UFT) 

IBM Rational Functional Tester 

4. What is Locator? By what means will you find a component in Selenium? 

Selenium utilizes finders to discover and coordinate the components of a website page that it needs to connect with. There are various kinds of finders to recognize different web components on a site page: 

ID 

Name 

Class 

Incomplete Link 

XPath 

CSS Selector 

Connection Text 

5. What are the test types upheld by Selenium? 

For testing electronic applications, Selenium can be utilized. 

The test types upheld by Selenium are: 

Practical testing: It confirms that each capacity of a product application acts as per explicit necessities. This testing fundamentally includes discovery testing, and it isn't worried about the source code of the application. 

Relapse testing: It is only a full or incomplete determination of the all around executed experiments to re-executed to guarantee whether the current functionalities turn out great. 

6. What is XPath? 

While DOM is the perceived standard route for exploring through a HTML component tree, XPath is the route apparatus used to find a web component dependent on its XML way. 

XML means 'Extensible Markup Language' and is utilized to store, put together, and transport self-assertive information. It stores information in a key–esteem pair that is a lot of like HTML labels. Both being markup dialects and falling under a similar umbrella, XPath can be utilized to find HTML components. 

The basic idea driving finding components utilizing XPath is crossing between different components across the whole page and in this way empowering a client to discover a component with the reference of another component. 

7. Clarify the contrast between Single slice and Double cut in XPath. 

Single Slash (/): Single slice is utilized to make a XPath with a flat out way. For this situation, the XPath would begin choice from the report's beginning hub. 

Twofold Slash (//): Double slice is utilized to make a XPath with a relative way. For this situation, the XPath would begin choice from anyplace inside the report. 

8. For what reason would it be advisable for me to utilize Selenium for test robotization? 

Selenium should be utilized for test computerization as it: 

Is a free and open-source instrument 

Has a huge client base and network uphold 

Has cross-program similarity (Firefox, Chrome, Internet Explorer, Safari, and so on) 

Has incredible stage similarity (Windows, Mac OS, Linux, and so forth) 

Supports different programming dialects (Java, C#, Ruby, Python, Perl, and so on) 

Has new and customary storehouse improvements 

Supports dispersed testing 

9. Does Selenium have any specialized restrictions? Assuming this is the case, what are those impediments? 

Truly, Selenium has a couple of restrictions: 

Testing of just web applications is conceivable utilizing Selenium. 

Testing of portable applications or work area applications is absurd. 

Manual human test and standardized tag perusers can't be tried utilizing Selenium. 

An outsider apparatus like TestNG or JUnit should be utilized to create reports. 

As Selenium is a free device, there is no prepared seller uphold through which clients can discover different aiding networks. 

Earlier programming language information is normal from clients. 

10. What isan article storehouse? 

An item storehouse permits analyzers to amass web components of the application under test (AUT), alongside their finder esteems, in at least one incorporated areas as limited to hard-coding them inside the test contents. 

11. What are the various kinds of Annotations utilized in Selenium? Clarify the JUnit Annotation connected with Selenium. 

In Java, an extraordinary type of syntactic metadata can be added to Java source code, which is known as 'comments'. Factors, boundaries, bundles, strategies, and classes are explained. A portion of the JUnit explanations are: 

Test 

Previously 

After 

Disregard 

BeforeClass 

AfterClass 

RunWith 

JUnit comments connected with Selenium are: 

@Test: The @Test comment discover a technique to be a test strategy. At the point when utilized before a test strategy, it is referenced as '@Test'; it illuminates the JUnit system that the accompanying technique is a test strategy. 

@Before: The @Before explanation is utilized to discover the technique that is executed prior to executing the test strategy. This strategy can be utilized to set up the test climate. 

@After: The @After comment is a technique that is executed in the wake of executing the test strategy. This technique can be utilized to do a teardown, i.e., it is a strategy used to erase all brief information, set-up default esteems, tidy up the test climate, and so forth 

@BeforeClass: The @BeforeClass strategy is utilized just a single time before the beginning, all things considered. Essentially, this is utilized to perform awkward exercises, such as interfacing with an information base. 

@AfterClass: The @AfterClass strategy is utilized just a single time subsequent to executing all tests. Essentially, this is utilized to do tidy up exercises, such as disengaging from an information base. 

12. For what reason do analyzers pick Selenium over QTP? 

Selenium is more generally utilized than QTP since: 

Selenium is an open-source device, while QTP is a productive instrument 

Selenium is utilized explicitly for testing electronic applications, while QTP can be utilized for testing customer worker applications as well 

Selenium bolsters various programs like Firefox, IE, Opera, Safari, and so forth and has numerous working frameworks similarity as well. Selenium-upheld OS stages are Windows, Mac, Linux, and so on Then again, QTP is restricted to Internet Explorer on Windows 

Selenium upholds multi-programming language similarity. Dialects upheld by Selenium are Python, Ruby, Perl, and so on However, QTP bolsters just VBScript 

13. What are the four components that you need to pass in Selenium? 

Four boundaries that should be passed in Selenium are: 

Host 

Port number 

Program 

URL 

14. What is Same-root Policy? How might we evade it? 

The 'Same-root Policy' is presented for security reasons. 

It guarantees that the substance of our site will never be available by a content from another site. 

According to the approach, any code stacked inside the program can just work inside that site's area. 

To evade this equivalent birthplace strategy, the intermediary infusion technique is utilized. In the intermediary infusion mode, Selenium Server deceives the program to be a genuine HTTP URL, i.e., it goes about as a customer designed HTTP intermediary, which sits between the program and the application under test (AUT) and afterward veils the AUT under an anecdotal URL. 

15. What are information driven structure and watchword driven system? 

An information driven structure in Selenium is a methodology of isolating a 'dataset' from the genuine 'experiment' (code). This system is totally reliant on the info test information. The test information is embedded from the outer sources, for example, from an Excel document, a CSV record, or from any information base. It additionally permits us to effectively control how much information should be tried. We can undoubtedly build the quantity of test boundaries by adding more username and secret word fields to the Excel record (or different sources). 

A catchphrase driven system is an expansion to the information driven testing structure as in it not just detaches the test information from the contents yet additionally keeps the specific part of the code having a place with the test content in an outside information document. These arrangements of code are known as catchphrases, and henceforth the system is so named. Watchwords are self-directing and work dependent on what activities should be performed on the application. 

16. In what manner will you use Selenium to transfer a document? 

On the off chance that the record is on a similar machine or in a planned organization drive, it is truly direct: We need to simply type the 'way' of the document in the FileUpload control.

Model: 

driver = webdriver.Firefox() 

component = driver.find_element_by_id("fileUpload") 

element.send_keys("C:\myfile.txt") 

17. What is the contrast among getwindowhandles() and getwindowhandle()? 

getwindowhandles(): It is utilized to get the location of every single open program, and its return information type is Set<String>. 

getwindowhandle(): It is utilized to get the location of the current program where the control is, and its return type is a string information type. 

18. What is Selenese and what are the three sorts of Selenese? 

Selenese is a bunch of orders in Selenium utilized for running a test. 

Three sorts of Selenese are as per the following: 

Activities: They are utilized for performing cooperations and tasks with the objective components. 

Accessors: They are utilized for putting away qualities in a variable. 

Affirmations: They are utilized as a checkpoint. 

19. On the off chance that I need to embed a breakpoint in Selenium IDE, how might I do that? 

To embed a breakpoint: 

To start with, we'll need to choose 'Switch Breakpoint' by right-tapping on the order in Selenium IDE 

At that point, press 'B' on the console and select the order 

A similar advance should be rehashed for deselecting a breakpoint 

20. How would I dispatch the internet browser utilizing WebDriver? 

The accompanying punctuation can be utilized to dispatch the program comparing to the framework's working framework: 

WebDriver driver = new FirefoxDriver(); 

Or on the other hand 

WebDriver driver = new InternetExplorerDriver(); 

Or on the other hand 

WebDriver driver = new ChromeDriver(); 

21. What are the various kinds of holds up accessible in WebDriver? 

There are two sorts of holds up accessible in WebDriver: 

Understood pause: These holds up are utilized to give a default holding up time (say, 30 seconds) between the continuous test ventures across the whole test content. Thus, the ensuing test step would possibly be executed just when the 30 seconds are over subsequent to executing the past test step. 

Express pause: These holds up are utilized to end the execution until a specific condition is met or the greatest time has slipped by. 

Express hangs tight are launched for a specific example just, while understood holds up are definitely not. 

22. How would I handle an edge in WebDriver? 

An iframe (an abbreviation for 'inline outline') is utilized to embed another record inside the current HTML report. 

Choosing iframe by ID: 

driver.switchTo().frame("ID of the casing"); 

Finding iframe utilizing the tagName: 

driver.switchTo().frame(driver.findElements(By.tagName("iframe").get(0)); 

Finding iframe utilizing list: 

frame(index) 

driver.switchTo().frame(0); 

frame("Name of the Frame") 

driver.switchTo().frame("name of the casing"); 

frame(WebElement component) 

Select Parent Window 

driver.switchTo().defaultContent(); 

3. How would I set the experiment need in TestNG? 

SettingPriority in TestNG: 

Test Execution Sequence: 

Method1 

Method2 

Method3 

24. What are the various sorts of systems? 

Various kinds of systems are as per the following: 

Module-based Testing Framework: This structure separates the whole application under test (AUT) into various consistent and segregated modules. For every module, we make a different and autonomous test content. Subsequently when these test contents are taken together, it assembles a bigger test content speaking to more than one module. 

Library Architecture Testing Framework: Instead of isolating AUT into test contents, with this system, we isolate the application into capacities or rather normal capacities that can be utilized by different pieces of the application also. In this manner, we make a typical library establishing of basic capacities for AUT. Accordingly, these libraries can be called from the test contents at whatever point required. 

Information driven Testing Framework: The information driven testing system causes us isolate the test content rationale and the test information from one another. It allows us to store the test information into an outside information base. The information is expectedly put away in 'key–esteem' sets. Keys can be utilized to get to and populate the information inside the test contents. 

Catchphrase driven Testing Framework: The watchword driven testing system is an expansion to the information driven testing structure as in it not just isolates the test information from the contents yet in addition keeps a specific arrangement of codes having a place with the test content in an outer information record. 

Cross breed Testing Framework: A mixture testing structure is a blend of more than one of the previously mentioned systems. The best thing about such an arrangement is that it use the advantages of a wide range of related systems. 

Conduct driven Development Framework: The conduct driven improvement structure permits the mechanization of practical approvals in an effectively decipherable and justifiable organization to Business Analysts, Developers, Testers, and so forth 

25. Depict the distinction among Selenium and QTP. 

Feature    Selenium    Quick Test Professional (QTP) 

Program compatibility    It underpins practically all well known programs: Firefox, Chrome, Safari, Internet Explorer, Opera, etc.    QTP upholds Internet Explorer, Firefox, and Chrome. It just backings Windows working framework 

Distribution    It is circulated as an open-source instrument and is unreservedly available    It is dispersed as an authorized device and is popularized 

Application under test (AUT)    It underpins the testing of electronic applications only    It upholds the testing of both online and Windows-based applications 

Article repository    Object store should be made as a different substance in Selenium    QTP consequently makes and keeps up the item vault 

Language support    It upholds various programming dialects like Java, C#, Ruby, Python, Perl, etc.    It underpins just VBScript 

Seller support    As Selenium is a free apparatus, clients would not get the merchant's help in investigating issues    Users can without much of a stretch get the seller's help on the off chance that they face any issues 

26. In Selenium, what are breakpoints and start focuses? 

Breakpoints: Breakpoints are utilized to slow down the execution of the test. The execution will stop at whatever point a breakpoint is actualized, and this will help us check if the code is working appropriately. 

Start focuses: Start focuses are the focuses from where the execution should start. Start focuses can be utilized when we need to run the test content from the center of the code or after a breakpoint. 

27. Notice the need of Session Handling while at the same time working with Selenium. 

While working with Selenium, we need meeting taking care of. This is on the grounds that, during test execution, Selenium WebDriver needs to cooperate with the program constantly to execute the provided orders. It is likewise conceivable that, before the current execution finishes, another person begins the execution of another content in a similar machine and in a similar kind of program. So to maintain a strategic distance from such a circumstance, we need meeting dealing with. 

28. Notice the kinds of Listeners in TestNG. 

The kinds of Listeners in TestNG are: 

IAnnotationTransformer 

IConfigurable 

IConfigurationListener 

IExecutionListener 

IHookable 

IInvokedMethodListener 

IInvokedMethodListener2 

IMethodInterceptor 

IReporter 

ISuiteListener 

ITestListener 

29. How might we handle Windows-based popups with Selenium? 

Selenium exclusively underpins web application testing. It doesn't uphold the testing of Windows-based applications or portable applications. To deal with Windows-based popups, outsider intercession is required. AutoIt and Robot Class are instances of outsider apparatuses that we can use close by Selenium to deal with Windows-based popups. 

30. For the information base testing in Selenium WebDriver, what API is required? 

For the information base testing in Selenium WebDriver, we need the JDBC (Java Database Connectivity) API. It permits us to execute SQL articulations. 

31. How might you recognize an article in Selenium? 

We can utilize isElementPresent (string finder) to discover an article in Selenium. It accepts a finder as the contention and, whenever discovered, restores a Boolean. 

32. Notice the utilization of XPath in Selenium testing. 

XPath is utilized to characterize web components on a page. The significant favorable position of XPath is it encourages us in distinguishing the components progressively. 

There are two kinds of XPath: 

Total XPath 

Relative XPath 

33. What is Selenium? 

Selenium is a mainstream open-source programming that is utilized to mechanize electronic applications. It is a bunch of numerous product devices, and each device has an alternate way to deal with computerized testing. 

Selenium has four significant parts, in particular: 

Selenium Integrated Development Environment 

Selenium Remote Control 

Selenium WebDriver 

Selenium Grid 

34. Could WebDriver test portable applications? 

No, WebDriver is a trying apparatus utilized for online applications. Thus, we can't test portable applications with Selenium WebDriver. 

35. Clarify how Selenium Grid functions. 

Selenium Grid makes a test suite that works by sending experiments to the center point, and from that point, the experiments are diverted to Selenium WebDriver. WebDriver will at that point execute them in the program. The test suite takes into consideration running tests in equal.




CFG