Selenium Interview Questions and Answers Set 9

81. Can captcha be automated?

No, captcha and barcode reader cannot be automated.

82. What is the difference between driver.get() and driver.navigate.to()

You can use both methods to navigate to an url.
Because navigating to a URL is very common, then driver.get() is a convenient way. However it does the same function as the driver.navigate().to(“url”)
The driver.navigate() also has other functions, such as

driver.navigate().back()

driver.navigate().forward()

driver.navigate().refresh()

83. What are the four parameters that have to be passed to Selenium?

Four parameters that have to be passed to selenium are:
• Host
• Port Number
• Browser
• URL 

84. What is a fundamental difference between XPath and css selector?

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

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

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

86. What are the different keyboard operations that can be performed in selenium?

The different keyboard operations that can be performed in selenium are-
.sendKeys(“sequence of characters”) – Used for passing charcter sequesnce to an input or textbox element.
.pressKey(“non-text keys”) – Used for keys like control, function keys etc that ae non text.
.releaseKey(“non-text keys”) – Used in conjuntion with keypress event to simulate releasing a key from keyboard event. 

87. How can we handle window UI elements and window POP ups using selenium?

Selenium is used for automating Web-based application only(or browsers only). For handling window GUI elements we can use AutoIT. AutoIT is a freeware used for automating window GUI. The AutoIt scripts follow simple BASIC language like syntax and can be easily integrated with selenium tests. 

88. What is an Object repository?

An object repository is a centralized location of all the object or WebElements of the test scripts. In selenium, we can create object repository using Page Object Model and Page Factory design patterns. 

89. What is a data-driven framework?

A data-driven framework is one in which the test data is put in external files like csv, excel etc separated from test logic written in test script files. The test data drives the test cases, i.e. the test methods run for each set of test data values. TestNG provides inherent support for data-driven testing using @dataProvider annotation. 

90. What is a hybrid framework?

Ans. A hybrid framework is a combination of one or more frameworks. Normally it is associated with the combination of data were driven and keyword driven frameworks where both the test data and test actions are kept in external files(in the form of a table).