Selenium Java Interview Questions And Answers – Part 6

Selenium Java Interview Questions And Answers – Part 6

Selenium Java Interview Questions and Answers Part-6

1) What is the difference between Manual and Automation Testing?

– Manual Testing shows lower accuracy due to the higher possibilities of human errors. Automation Testing depicts a higher accuracy due to computer-based testing eliminating the chances of errors.
– Manual Testing needs time when testing is needed at a large scale. Automation Testing easily performs testing at a large scale with the utmost efficiency.
– Manual Testing takes more time to complete a cycle of testing, and thus the turnaround time is higher. Automation Testing completes a cycle of testing within record time and thus the turnaround time is much lower.
– Manual Testing should be used to perform Exploratory Testing, Usability Testing and Ad-hoc Testing to exhibit the best results. Automation Testing should be used to perform Regression Testing, Load Testing, Performance Testing and Repeated Execution for best results.
– Exploratory testing is possible in Manual Testing. Automation does not allow random testing.
– The initial investment and ROI in the Manual testing is lower compared to Automation testing in the long run. The initial investment in the automated testing is higher and the ROI is better in the long run.

2) What are the benefits of Automation Testing?

– ROI: Even though the initial investment is high, return on investment over time is much better
– Running tests: Tests can be run automatically or can be scheduled at a particular time
– Fewer human resources: Manual testers are not required
– Reusability: Scripts are reusable
– Bugs: Automation helps you find bugs in the early stages of software development
– Reliability: Automated testing is more reliable and way quicker
– Parallel testing: Automated tests can be run parallelly on multiple devices

3) Which Test cases needs to be automated?

– Tests that need to be run against every build/release of the application, such as smoke test, sanity test and regression test.
– Tests that need to run against multiple configurations — different OS & Browser combinations.
– Tests that execute the same workflow but use different data for its inputs for each test run e.g. data-driven.
– Tests that involve inputting large volumes of data, such as filling up very long forms.
– Tests that take a long time to perform and may need to be run during breaks or overnight.

4) What are the popular test automation tools for functional testing?

– Selenium
– Unified Functional Testing
– Test Complete
– Ranorex
– Tosca

5) What is the main purpose of Automation Testing?

Automation testing is the best way to increase the effectiveness, efficiency and coverage of your software testing.

6) What is the goal of Automation Testing?

– To reduce Testing Cost and Time.
– To reduce Redundancy.
– To speed up the Testing Process.
– To help improve Quality.
– To improve Test coverage.
– To reduce Manual Intervention.

7) Why Selenium should be selected as a Test tool?

– Language & Framework support: Selenium supports all major languages like Java, Python, JavaScript, C#, Ruby, and Perl programming languages for software test automation. Also, every Selenium supported language has dedicated frameworks which help in writing test script for Selenium test automation.
– Open source: Being an open source tool, Selenium is a publicly accessible automation framework and is free, with no upfront costs.
– Multi browser support: Selenium script is compatible with all browsers like Chrome, Safari, IE, etc …
– Support across various OS: Selenium is yet a highly portable tool that supports and can work across different operating systems like Windows, Linux, Mac OS, UNIX, etc.
– Ease of implementation: Selenium automation framework is very easy-to-use tool. Selenium provides a user-friendly interface that helps create and execute test scripts easily and effectively.
– Reusability and Integrations: Selenium needs third-party frameworks and add-ons to broaden the scope of testing.For example, it can integrate with TestNG and JUnit for managing test cases and generating reports.
– Parallel Test Execution: With the help of Selenium Grid, we can execute multiple tests in parallel, hence reducing the test execution time.

8) What are the testing types that can be supported by Selenium?

– Functional Testing
– Regression Testing
– Sanity Testing
– Smoke Testing
– Responsive Testing
– Cross Browser Testing
– UI testing (black box)
– Integration Testing

9) What are the limitations of Selenium?

– Selenium does not support automation testing for desktop applications.
– Since Selenium is open source software, you have to rely on community forums to get your technical issues resolved.
– It does not have built-in Object Repository like UTF/QTP to maintain objects/elements in centralized location.
– Selenium does not have any inbuilt reporting capability and you have to rely on plug-ins like JUnit and TestNG for test reports.

10) What is the difference between Selenium IDE, Selenium RC and Selenium WebDriver?

Selenium IDE:
– It only works in Mozilla browser.
– It supports Record and playback
– Doesn’t required to start server before executing the test script.
– It is a GUI Plug-in
– Core engine is Javascript based
– Very simple to use as it is record & playback.
– It is not object oriented
– It does not supports listeners
– It does not support to test iphone/Android applications

Selenium RC:
– It supports with all browsers like Firefox, IE, Chrome, Safari, Opera etc.
– It doesn’t supports Record and playback
– Required to start server before executing the test script.
– It is standalone java program which allow you to run Html test suites.
– Core engine is Javascript based
– It is easy and small API
– API’s are less Object oriented
– It does not supports listeners
– It does not support to test iphone/Android applications

Selenium Webdriver:
– It supports with all browsers like Firefox, IE, Chrome, Safari, Opera etc.
– It doesn’t supports Record and playback
– Doesn’t required to start server before executing the test script.
– It is a core API which has binding in a range of languages.
– Interacts natively with browser application
– As compared to RC, it is bit complex and large API.
– API’s are entirely Object oriented
– It supports the implementation of listeners
– It support to test iphone/Android applications

11) When should I use Selenium IDE?

Because of its simplicity, Selenium IDE should only be used as a prototyping tool, not an overall solution for developing and maintaining complex test suites.

12) What is Selenese?

Selenese is the set of selenium commands which are used to test your web application. Tester can test the broken links, existence of some object on the UI, Ajax functionality, Alerts, window, list options and lot more using selenese.

13) What is the difference between Assert and Verify commands?

In case of the “Assert” command, as soon as the validation fails the execution of that particular test method is stopped and the test method is marked as failed. Whereas, in case of “Verify”, the test method continues execution even after the failure of an assertion statement.

14) What is Same Origin Policy and how it can be handled? How to overcome same origin policy through web driver?

Selenium uses java script to drives tests on a browser. Selenium injects its own js to the response which is returned from aut. But there is a java script security restriction (same origin policy) which lets you modify html of page using js only if js also originates from the same domain as html.

15) How do you use findElement() and findElements()?

WebElement login= driver.findElement(By.linkText("Login"));
List<WebElement> listOfElements = driver.findElements(By.xpath("//div"));


16) Can Selenium handle window based pop up?

No. Selenium cannot handle window based pop-up on its own but can use third party tools.

17) How can we handle window based pop up using Selenium?

We can handle window based popups using some third party tools such as AutoIT, Robot class.

18) How can we handle web-based pop up using Selenium?

Step 1: After opening the website, we need to get the main window handle by using driver.getWindowHandle();
Step 2: We now need to get all the window handles by using driver.getWindowHandles();
Step 3: We will compare all the window handles with the main Window handles and perform the operation the window which we need.

19) How to assert title of the web page?

String actualTitle = driver.getTitle();
String expectedTitle = "Title of Page";


20) How to mouse hover on a web element using WebDriver?

Actions builder = new Actions(driver);


21) How to retrieve CSS Properties of an element?



22) What is JUnit?

JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks.

23) What are JUnit annotations?

Annotation is a special form of syntactic meta-data that can be added to Java source code for better code readability and structure.
Some of them are:
– @Before
– @After
– @BeforeClass
– @AfterClass
– @Ignore
– @RunWith
– @Test

24) What is TestNG and what is its use?

TestNG is an automation testing framework in which NG stands for “Next Generation”. TestNG is inspired from JUnit which uses the annotations (@). Using TestNG you can generate a proper report, and you can easily come to know how many test cases are passed, failed and skipped.

25) How is TestNG better than JUnit?

– In TestNG Annotations are easy to understand over JUnit.
– TestNG enable you to grouping of test cases easily which is not possible in JUnit.
– TestNG allows us to define the dependent test cases each test case is independent to other test case.
– Parallel execution of Selenium test cases is possible in TestNG.

Next Steps:

> More interview questions and answers on Selenium Java, continue to the next post (Click on Next Post link below)

> Check complete Selenium Java interview questions and answers here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning ?

About Me > Bijan Patel

Connect to me on Linked In (Click here)

On a mission to contribute to the Software Testing Community in all possible ways.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp