Special Offer - Enroll Now and Get 2 Course at $398/- Only Explore Now!

All Courses
Selenium Cucumber Interview Questions & Answers

Selenium Cucumber Interview Questions & Answers

June 25th, 2020

Selenium Cucumber Interview Questions and Answers

In case you’re searching for Selenium Cucumber Interview Questions and answers for Experienced or Freshers, you are at the correct place. Selenium Cucumber Interview Questions and Answers provided over here will familiarize you to the maximum frequently posted questions in interviews. The question lists provided are prepared by experts in a well-organized manner which will easily boost you for the interview preparation. There is parcel of chances from many presumed organizations on the planet. The Cucumber advertise is relied upon to develop to more than $5 billion by 2021, from just $180 million, as per Selenium industry gauges. In this way, despite everything you have the chance to push forward in your vocation in Selenium Development. GangBoard offers Advanced Cucumber Interview Questions and answers that assist you in splitting your PowerPoint interview and procure dream vocation as Selenium Tester.

Best Selenium Cucumber Interview Questions and Answers

Cucumber Interview Questions and answers are very useful to the Fresher or Experienced person who is looking for the new challenging job from the reputed company. Our Cucumber Questions and answers are very simple and have more examples for your better understanding. By this Cucumber Interview Questions and answers, many students are got placed in many reputed companies with high package salary. So utilize our Cucumber Interview Questions and answers to grow in your career.

Q1. What are the limitations of Selenium?

Ans.

  1. It is a web only test automation tool. Not for windows applications.
  2. Captcha & OTP validation is not possible
  3. No integrated report generation system
  4. No tool based UI provided like UFT. Everything is code driven

Q2. What are the different locators can be used to identify an object?

Ans.  There are 8 locators to identify objects in selenium

  1. ID
  2. TagName
  3. ClassName
  4. Name
  5. LinkText
  6. PartialLinkText
  7. CSS Selector
  8. Xpath

Q3. What is Xpath of an Object?

Ans.  Xpath is used to find element in HTML structure. Xpath is based on an objects XML (Extensible Markup Language) path. It stores location of an object in the whole HTML body, which can be derived by following path and divisions of an object or by using specific methods inside xpath.

Q4. What is the difference between findelement and findelements ?

Ans.   findelement returns one specific object found by given locator. findelements returns list of all objects found by the given locator.

Q5. What are the methods used to switch frame and window tabs?

Ans. SwitchTo() is used to switch frame or window. Frame name or index, Window name or index is passed as argument in SwitchTo method.

driver.switchTo().frame(“FrameName”);

driver.switchTo().window(“WindowName”);

Q6. What is the difference between Relative xpath & Absolute xpath?

Ans. Absolute xpath identifies object from the root of the HTML structure. It starts with html/body. Relative xpath begins with // and finds an object anywhere in the html structure with a unique identifier. Relative xpath uses specific internal methods like text(), contains(), etc..

Q7. How to select a dropdown from webpage?

Ans. Select class is used to select value in any dropdown. Any value can be selected by its index number or the text displayed.

Q8. How to move back to the previous URL in a webpage using Selenium?

Ans. navigate.back() can be used to navigate back to previous page.

Q9. How many times of waits are there in selenium?

Ans. There are three types of waits – implicit wait, explicit wait and fluent wait. Besides those we can use threed.sleep also if needed.

Q10. How to get a text from the webpage and enter a text in a field?

Ans. getText() method returns the text displayed in the webpage for an object. To enter data in any field, we use sendKeys() where the text is passed as argument.

Q11. What is the difference between driver close and quit methods?

Ans. driver.close() closes only the current window tab where selenium is having access. Driver.quit() close all open windows

Q12. Which class is used for mouse and keyboard related actions?

Ans. Action class is used for mouse and keyboard related actions.

Q13. How to handle windows related pop-up ?

Ans. We can use AutoIT or Robot class to handle windows related pop ups.

Q14. What is Assert?

Ans. Assert comes with Junit or TestNG. It is used for validation. It makes the juniit report green if passed or blue if failed.

Q15. How to scroll using scroll bar to reach an element in selenium?

Ans. We can use javaScriptExecutor to scroll down.

((JavascriptExecutor) driver).executeScript(“arguments[0].scrollIntoView();”, element);

Q16. How to take screenshot of a whole page using selenium?

Ans. Using getScreenShotAs method we can take screenshot  –

File scrFile = ((TakeScreenshot)driver).getScreenshotAs(outputType.FILE);

Q17. How to accept or reject web alert pop up?

Ans. By using Alert class, we can accept or reject web alert pop ups.

driver.switchTo().alert().accept();

driver.switchTo().alert().dismiss();

Q18. What is the purpose of the Behavior Driven Development (BDD) approach while Automation Framework design?

Ans. The purpose of the Behavior Driven Development framework is to make different project roles such as Business Analysts, Quality Assurance, Developers, Support Teams understand the application automation scenarios and related changes without going into the technical aspects.

Q19. What is Gherkin?

Ans.  Gherkin is the language that is used by the Cucumber tool. It is a simple English representation of the application behavior. Gherkin language uses several keywords to describe the behavior of applications such as Feature, Scenario, Scenario Outline, Given, When, Then, etc.

Q20. What symbol for parameterization in Cucumber?

Ans. Pipe symbol (|) is used to specify parameters values in a Cucumber

Q21. What is the file extension for feature file?

Ans.  File Extension for feature file is .feature.

Q22. Explain the purpose of keywords that are used for writing a scenario in Cucumber.

Ans.

  • “Given” keyword is used to specify a precondition for the scenario.
  • “When” keyword is used to specify an operation to be performed.
  • “Then” keyword is used to specify the expected result of a performed action.
  • “And” keyword is used to join one or more statements together into a single statement.

Q23. Why is Scenario Outline used in Cucumber?

Ans. This is ideally used when the same scenario is executed for multiple sets of data, and the test steps remain the same. Scenario Outline must be followed by the keyword ‘Examples’, which specify the set of values for each parameter.

Q24. What is the use of Background keyword in Cucumber?

Ans. This is generally used when the same set of given statements are repeated before each scenario of the feature file.

Q25. What is StepDefination file?

Ans. Step definition maps the test case steps in the feature file (Given/When/Then) to code which executes and checks the outcomes from the system under test.

Q26. What are Before, After hooks?

Ans. Before executes before the whole feature file execution. After executes after the whole feature file execution.

Q27. What is the regex pattern to pass a variable from Feature file to StepDefination?

Ans. \”([^\”]*)\” is the regex to use to pass data from Feature file to Stepdefinition.

Q28. What is Apache POI?

Ans. Apache POI jar is used to read and write data from Excel sheet.

Q29. How to click an object without using selenium Click method?

Ans. We can click using JavaScriptExecutor. Following method can be used to click –

JavascriptExecutor js = (JavascriptExecutor)driver;     js.executeScript(“arguments[0].click();”, button);

Q30. What is a Framework?

Ans.

A framework defines a structure or set of practices which we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common are-

  • Data Driven Testing Framework
  • Keyword Driven Testing Framework
  • Hybrid Testing Framework
  • Behavioural Driven Framework