Interview Questions.

Interview Questions For Selenium with Java

fluid

Interview Questions For Selenium with Java

Q1. What is test automation or automation checking out?

Ans: Automation checking out is used to automate the manual testing. It is a manner of automating the manual process to test the software/device below test. It makes use of separate testing gear which facilitate you to create take a look at scripts which can be executed time and again and would not want any guide intervention.

Q2. What are the advantages of automation checking out?

Ans:

It helps execution of repeated test instances.

It facilitates parallel execution.

It aids in testing a big take a look at matrix.

It improves accuracy due to the fact there aren't any possibilities of human errors.

It saves time and money.

Q3. What is selenium? What are the one-of-a-kind components of selenium?

Ans: Selenium is one of the most famous computerized checking out suites. It is browser automation device which lets you automatic operations like click, type and selection from a drop down of a web page. It is designed to support and inspire automation checking out of functionalities of web based totally applications and a huge range of browsers and systems. It is one of the maximum familiar equipment among the trying out professional due to its life inside the open supply community.

Selenium isn't only a single tool in preference to it's miles a package deal of numerous testing tools and that?S why it's far referred as a suite. Each of those tools is designed to cater extraordinary checking out and test surroundings requirement.

Q4. What is Selenium 1.Zero?

Ans: Selenium 1.Zero is popularily called Selenium Remote Control (Selenium RC). It is a library to be had in extensive style of languages. The fundamental motive to apply Selenium RC turned into that Selenium IDE turned into incapable to execute checks in browsers aside from Selenium IDE and the issue of language Selenese utilized in Selenium IDE.

Q5. What is Selenium IDE?

Ans: Selenium IDE is a firefox plug-in. It is used to record and replay exams in firefox browser. It is used simplest with firefox browser.

Q6. What is selenium 2.Zero?

Ans: Selenium 2.Zero is a device that's a aggregate of net checking out tools Selenium RC and WebDriver.

Q7. Why is selenium selected as a check tool?

Ans: Selenium is used as a trying out device due to the fact:

It is loose and open source.

It has a massive user base and supporting groups.

Compatible on specific structures i.E. Windows, Mac OS, Linux and many others.

Have pass browser compatibility (Chrome, Firefox, IE, Safari and so on.)

Support multiple programming languages ( Java, C#, Ruby, PERL, Python and so on.)

Support allotted trying out.

Q8. What are selenium helping checking out types?

Ans: Selenium helps  varieties of trying out:

Functional Testing.

Regression Testing.

Q9. What are the constraints of selenium?

Ans: Selenium has following barriers:

It may be used only to check internet primarily based utility.

Mobile programs can not be examined using selenium.

You can not take a look at captcha and bar code by way of the use of selenium.

The person need to have the understanding of programming language for the usage of selenium.

Reports can simplest be generated using third party gear like TestNG or Junit.

Q10. What is selenese?

Ans: Selenese is a lanuage that is used for writing take a look at script in selenium IDE.

Q11. Describe the special varieties of locators in Selenium?

Ans: Locator is an address which identifies an internet element uniquely in the internet page.

There are specific forms of locators in Selenium to become aware of net elements as it should be and precisely.

These are:

ID

ClassName

Name

TagName

LinkText

PartialLinkText

Xpath

CSS Selector

DOM

Q12. What is an Xpath?

Ans: Xpath is used to find a web detail based totally on its XML course. It can be used to discover HTML elements.

Q13. Which is the modern day Selenium tool?

Ans: The trendy Selenium tool is WebDriver.

Q14. What are the distinctive styles of Drivers that WebDriver incorporates?

Ans: These are the one-of-a-kind drivers to be had in WebDriver:

FirefoxDriver

InternetExplorerDriver

ChromeDriver

SafariDriver

OperaDriver

AndroidDriver

IPhoneDriver

HtmlUnitDriver

Q15. What are the extraordinary types of annotations which are used in Selenium?

Ans: JUnit annotations which may be used are:

Test

Before

After

Ignore

BeforeClass

AfterClass

RunWith

Q16. What is Selenium Grid?

Ans: Selenium Grid facilitates you to distribute your tests on a couple of machines and all of them at the same time. So, you may execute tests on Internet Explorer on Windows and Safari on Mac gadget using the same text script. It reduces the time of take a look at execution and presents short feedback.

Q17. Where the result is visible of Test Execution in Selenium IDE?

Ans: The end result of take a look at execution is displayed in a Log Window in Selenium IDE.

Q18. Can you edit assessments in Selenium IDE?

Ans: Yes, checks in Selenium IDE can be edited. There are  ways to edit assessments in Selenium IDE.

By Table views

Looking into the supply code

Q19. Can you use html identity and name while the use of Selenium IDE?

Ans: Yes, You can use html identity and call as it's far available in Selenium IDE.

Q20. What are the WebDriver supported Mobile Testing Drivers?

Ans: WebDriver supported "cellular checking out drivers" are:

AndroidDriver.

IphoneDriver.

OperaMobileDriver.

Q21. What are the famous programming languages supported by Selenium WebDriver to write down Test Cases?

Ans:

JAVA.

PHP.

Python.

C#.

Ruby.

Perl.

Q22. What is the difference between assert and confirm commands?

Ans:  Assert: Assert command assessments if the given condition is genuine or false. If the situation is true, this system manage will execute the next section of trying out, and if the situation is fake, execution will prevent and nothing could be performed.

Verify: Verify command additionally exams if the given condition is authentic or false. It does not halts program execution i.E. Any failure all through verification might now not prevent the execution and all the test stages could be carried out.

Q23. What is the distinction among "/" and "//" in Xpath?

Ans:  Single Slash "/": Single decrease is used to create Xpath with absolute path.

Double Slash "//": Double slash is used to create Xpath with relative route.

Q24. What is the difference among motive force.Get() and driver.Navigate.To()?

Ans:  Both methods may be used to navigate to a url however the driver.Get() is a handy way to navigate to a url. The motive force.Navigate() does the equal characteristic as the driver.Navigate().To(?Url?) however it also has different capabilities, including:

motive force.Navigate().Again()

motive force.Navigate().Ahead()

driver.Navigate().Refresh()

Q25. What is the distinction among implicit wait and specific wait in selenium webdriver?

Ans: Implicit Wait: In Implicit wait, if WebDriver can't find an detail within the Document Object Model (DOM), it's going to anticipate a described amount of time for the detail to appear in the DOM. The Implicit wait may slow down your checks, due to the fact as soon as set, the implicit wait is set for the life of the WebDriver item's example.

An instance of Implicit Wait:

motive force.Manipulate().Timeouts().ImplicitlyWait(10, TimeUnit.SECONDS);

Explicit Wait:

Explicit waits are higher than implicit wait. Unlike an implicit wait, you can write custom code or situations for wait earlier than proceeding further inside the code.

An explicit wait may be used wherein synchronization is needed, as an example the web page is loaded however we're nevertheless watching for a call to complete and an element to seem.

An instance of Implicit Wait: 

WebDriverWait wait = new WebDriverWait(motive force, 10);

wait.Till(ExpectedConditions.TitleContains("selenium"));

Q26. What is the difference between type keys and kind commands?

Ans: TypeKeys() will cause JavaScript occasion in maximum of the instances while .Type() might not.

Q27. What is the distinction among "type" and "typeAndWait" command?

Ans: "kind" command is used to kind keyboard key values into text field of software web software. It can also be used for choosing values of combo container while "typeAndWait" command is used when your typing is completed and software program web web page start reloading. This command will anticipate software program software web page to reload. If there is not web page reload event on typing, you need to use simple "type" command.

Q28. What is the distinction among sleep() and setSleep() method?

Ans: Sleep() and setSleep() each strategies are used to delay the speed of execution.

Thread.Sleep (): It is used to forestall the current (java) thread for the specified time period. It's executed only once.

It takes a unmarried argument in integer format.

For Example: thread.Sleep(5000)- It will watch for five seconds.

It waits handiest as soon as on the command given at sleep.

SetSpeed (): It will forestall the execution for each selenium command for precise amount of time.

It takes a single argument in integer format.

For Example: selenium.SetSpeed("5000")- It will watch for 5 seconds.

It runs each command after setSpeed delay via the quantity of milliseconds cited in set Speed.

Q29. What is the distinction between discover element () and findElements ()?

Ans: find detail (): It is used to discover the first element inside the modern web page the use of the given "locating mechanism". It returns a single WebElement.

FindElements () : It makes use of the given "locating mechanism" to locate all of the factors within the contemporary web page. It returns a listing of internet elements.

Q30. How to kind in a text box the usage of Selenium?

Ans: To type in a text container, we use sendKeys("String to be entered") to insert string in the text field.

Syntax: 

WebElement username = drv.FindElement(By.Id("Email"));

// coming into username

username.SendKeys("sth");

Q31. What is JUnit?

Ans: JUnit is an open source testing framework for java packages. It is delivered via Apache.

Q32. What is JUnit Annotation?

Ans: Annotation is a technique of including a special shape of syntactic meta-facts to Java source code. Variables, parameters, packages, methods and instructions are annotated a number of the JUnit annotations.

Q33. What are the four parameters that you need to skip in Selenium?

Ans: The 4 parameters that you need to skip in Selenium are:

Host.

Port Number.

Browser.

URL.

Q34. How are you able to "post" a shape the use of Selenium ?

Ans: 

WebElement el  =  driving force.FindElement(By.Id("ElementID"));

el.Post();

Q35. What is the difference among close() and end()?

Ans: The near() approach closes the modern browser best while give up() technique closes all browsers opened through WebDriver.

Q36. What is wait? How many forms of waits in selenium?

Ans: The concept of waits is delivered with the aid of Selenium Webdriver for AJAX based application. There are  kinds of waits:

Implicit Wait

Explicit Wait

Q37. What is the main downside of implicit wait?

Ans: The principal disadvantage of implicit wait is that it slows down take a look at performance.

Another drawback of implicit wait is:

Suppose, you set the ready restriction to be 10 seconds and the factors seems inside the DOM in eleven seconds, your assessments can be failed due to the fact you instructed it to wait a maximum of 10 seconds.

Q38. How could you test if a take a look at-field or radio button is chosen?

Ans: You can use the isSelected() method to test if a take a look at-field or radio button is chosen.

Syntax: 

driver.FindElement(By.Identification("id_of_checkbox")).IsSelected();

 

Q39. How could you do drag and drop in Selenium Webdriver?

Ans: You can do drag and drop in Selenium by way of using the subsequent code:

Actions movement = new Actions(driver);

WebElement start = driver.FindElement(By.CssSelector(?Div.Supply?));

WebElement cease = driving force.FindElement(By.CssSelector(?Div.Goal?));

movement.DragAndDrop(start,stop).Carry out();

Q40. How would you take a look at if an element is visible at the web page?

Ans: isDisplayed() approach is used to test if an detail is seen at the page. The go back type of this approach is Boolean so, if it returns true, the detail is visible in any other case it isn't always. 

Driving force.FindElement(By.Id(?Id_of_element?)).IsDisplayed();

Q41. How could you take a look at if a button is enabled on a page?

Ans: isEnabled() technique is used to check if a button is enabled on a page. The go back kind of this approach is Boolean so, if it returns actual, the element is seen otherwise it is not. 

Motive force.FindElement(By.Identification(?Id_of_element?)).IsEnabled();

Q42. What are the primary technical troubles befell with Selenium equipment?

Ans: Like different automation testing gear, selenium additionally helps you to document, edit and debug test instances. But there are a few troubles that affect the maintainability of recorded take a look at instances. Sometimes it takes greater time to hold computerized take a look at cases than to perform manual trying out. Another problem is complicated identification for an HTML element. If ID is automobile generated, the recorder test cases can fail for the duration of playback.

Q43. Which is the post release validation with non-stop integration automation tool?

Ans: These gear are:

Jenkins

Hudson

Quick Build

CruiseCont

Q44. What are the four parameters that must be exceeded in Selenium?

Ans: Four parameters that must be passed in selenium are:

Host

Port Number

Browser

URL




CFG