Interview questions for selenium (1)

INTERVIEW QUESTIONS FOR SELENIUM
 
  1. What is Automation Testing?

Automation testing or Test Automation is a procedure of automating the manual procedure to test the application/framework under test. Automation testing includes the utilization of a different testing instrument which lets you make test contents that can be executed over and over and doesn’t require any manual intercession.

  1. What are the Advantages of Automation Testing?

Advantages of Automation testing are:

  • Supports execution of rehashed experiments
  • Helps in testing a huge test framework
  • Empowers parallel execution
  • Empowers unattended execution
  • Improves precision in this manner decreasing human-created blunders
  • Sets aside time and cash.
  1. What is Selenium?

Selenium is one of the most mainstream robotized testing suites. Selenium is planned in a manner to help and support automation testing of utilitarian parts of electronic applications and a wide scope of programs and stages. Because of its reality in the open-source network, it has gotten one of the most acknowledged devices among the testing experts.

Selenium isn’t only a solitary device or a utility, rather a bundle of a few testing apparatuses and for a similar explanation, it is alluded to as a Suite. Every one of these apparatuses is intended to cook distinctive testing and test condition necessities.

  1. What are the different Selenium Components?

The different Selenium components are

Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback apparatus. It is circulated as a Firefox Plugin.

Selenium Remote Control (RC) – Selenium RC is a server that enables a client to make test contents in the ideal programming language. It additionally permits executing test contents inside the huge range of programs.

Selenium WebDriver – WebDriver is an alternate device out and out that has different favorable circumstances over Selenium RC. WebDriver straightforwardly speaks with the internet browser and utilization’s its local similarity to computerize.

Selenium Grid – Selenium Interview Questions Grid is utilized to appropriate your test execution on various stages and conditions simultaneously.

  1. Why should Selenium selected as a test tool?
  • Selenium is a free and open-source
  • have a huge client base and helping networks
  • have cross Browser similarity (Firefox, Chrome, Internet Explorer, Safari and so on.)
  • have incredible stage similarity (Windows, Mac OS, Linux and so on.)
  • underpins various programming dialects (Java, C#, Ruby, Python, Pearl and so forth.)
  • has new and normal vault advancements
  • underpins appropriated testing
  1. What ate the testing types that supports selenium?

Selenium underpins the accompanying kinds of testing:

Regression Testing

Functional Testing

  1. What are the limitations of Selenium?

Following are the limitations of Selenium. They are

  • Selenium underpins testing of just online applications
  • Versatile applications can’t be tried utilizing Selenium
  • Captcha and Bar-code perusers can’t be tried utilizing Selenium
  • Reports must be created utilizing outsider devices like TestNG or JUnit.
  • As Selenium is a free device, in this manner, there is no prepared seller support through the client who can discover various helping networks.
  • The client is required to have earlier programming language information.
  1. When do I use Selenium IDE?

Selenium IDE is the most straightforward and least demanding of the considerable number of devices inside the  . Its record and playback highlight makes it particularly simple to learn with insignificant associates to any programming language. Selenium interview questions is a perfect apparatus for an innocent client.

  1. What is Selenese?

Selenese is the language that is utilized to compose test contents in Selenium interview questions.

  1. What are the various types of locators in Selenium?

The locator can be named as a location that recognizes a web component exceptionally inside the page. Along these lines, to distinguish web components precisely and exactly we have various sorts of locators in Selenium interview questions :

  • ID
  • ClassName
  • Name
  • TagName
  • link text
  • PartialLinkText
  • Xpath
  • CSS Selector
  • DOM
  1. What is the difference between Assert and verify commands?

Assert: Assert direction checks whether the given condition is valid or bogus. Suppose we state whether the given component is available on the site page or not. If the condition is valid, at that point the program control will execute the following test step yet if the condition is bogus, the execution would stop and no further test would be executed.

Verify: Verify direction additionally checks whether the given condition is valid or bogus. Regardless of the condition being valid or bogus, the program execution doesn’t stop for example any disappointment during check would not stop the execution and all the test steps would be executed.

  1. What is Xpath?

Xpath is utilized to find a web component dependent on its XML way. XML represents Extensible Markup Language and is utilized to store, compose and transport subjective information. It stores information in a key-esteem pair which is particularly like HTML labels. Both being markup dialects and since they fall under a similar umbrella, Xpath can be utilized to find HTML components.

The principal behind finding components utilizing XPath is navigating between different components over the whole page and subsequently empowering a client to discover a component with the reference of another component.

  1. What is the difference between single slash ( / ) and double slash ( // ) ?

Single Slash “/” – Single cut is utilized to make Xpath with a supreme way, for example, the Xpath would be made to begin choosing from the reporting hub/start hub.

Double Slash “//” – Double slice is utilized to make Xpath with a relative way, for example, the Xpath would be made to begin choice from anyplace inside the archive.

  1. What is the Same origin policy and how it is handled?

The issue of the same birthplace strategy denies getting to the DOM of a report from a source that is not the same as the starting point we are attempting to get to the record.

Along these lines, the Selenium Core (JavaScript Program) can’t get to the components from a birthplace that is not quite the same as where it was propelled.

In this way, In request to deal with a similar beginning approach, Selenium Remote Control was presented.

  1. When should I use Selenium Grid?

Selenium Grid can be utilized to execute the same or diverse test contents on various stages and programs simultaneously to accomplish circulated test execution, testing under various situations and sparing execution time astoundingly.

  1. What is Selenium 1 and Selenium 2?

Selenium RC and WebDriver, in a blend, are famously known as Selenium 2. Selenium RC alone is additionally alluded to as Selenium 1.

  1. What is the latest Selenium tool?

The latest Selenium tool is WebDriver.

  1. How do I launch the browser using WebDriver?

The accompanying sentence structure can be utilized to dispatch Browser:

  • WebDriver driver = new FirefoxDriver();
  • WebDriver driver = new ChromeDriver();
  • WebDriver driver = new InternetExplorerDriver();
  1. What are the different type of drivers available in WebDriver?

The various drivers accessible in WebDriver are:

  • FirefoxDriver
  • InternetExplorerDriver
  • ChromeDriver
  • SafariDriver
  • OperaDriver
  • AndroidDriver
  • IPhoneDriver
  • HtmlUnitDriver
  1. What are the different types of waits available in WebDriver?

There are two kinds of waits up accessible in WebDriver:

  • Implicit Wait
  • Explicit Wait

Implicit Wait: Implicit holds up are utilized to give a default holding up time (say 30 seconds) between each back to back test step/order over the whole test content. Therefore, the ensuing test step would possibly execute when the 30 seconds have slipped by after executing the past test step/direction.

Explicit Wait: Explicit holds up are utilized to end the execution till the time a specific condition is met or the greatest time has slipped by. In contrast to Implicit pauses, express hangs tight are applied for a specific case as it were.

  1. How to type text box by using Selenium?

The client can utilize sendKeys(“String to be entered”) to enter the string in the textbox.

Grammar:

WebElement username = drv.findElement(By.id(“Email”));

/entering username

username.sendKeys(“sth”);

  1. How can find a element in displayed on the Screen?

WebDriver encourages the client with the accompanying techniques to check the permeability of the web components. These web components can be catches, drop boxes, checkboxes, radio catches, names and so forth.

  • isDisplayed()
  • isSelected()
  • isEnabled()

Syntax structure:

isDisplayed():

boolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();

isSelected():

boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

isEnabled():

boolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();

  1. How can we get a text of a web element?

Get order is utilized to recover the internal content of the predefined web component. The direction doesn’t require any parameter yet restores a string esteem. It is additionally one of the widely utilized directions for check of messages, marks, blunders and so on showed on the site pages.

Language structure:

String Text = driver.findElement(By.id(“Text”)).getText();

  1. How to select value in drop down?

The incentive in the dropdown can be chosen utilizing WebDriver’s Select class.

Language structure:

selectByValue:

Select selectByValue = new Select(driver.findElement(By.id(“SelectID_One”)));

selectByValue.selectByValue(“greenvalue”);

selectByVisibleText:

Select selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”)));

selectByVisibleText.selectByVisibleText(“Lime”);

selectByIndex:

Select selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”)));

selectByIndex.selectByIndex(2);

  1. What are the different types of navigation commands?

Following are the navigation commands. They are-

navigate().back() – The above direction requires no parameters and reclaims the client to the past website page in the internet browser’s history.

Test code:

driver.navigate().back();

navigate().forward() – This direction lets the client to explore to the following website page concerning the program’s history.

Test code:

driver.navigate().forward();

navigate().refresh() – This direction lets the client to revive the present website page there by reloading all the web components.

Test code:

driver.navigate().refresh();

navigate().to() – This direction lets the client to dispatch another internet browser window and explore to the predetermined URL.

Test code:

driver.navigate().to(“https://google.com”);

  1. How to click on a hyper link using link text?

driver.findElement(By.linkText(“Google”)).click();

The order finds the component utilizing join content and afterward clicks on that component and hence the client would be re-coordinated to the comparing page.

The previously mentioned connection can likewise be gotten to by utilizing the accompanying order.

driver.findElement(By.partialLinkText(“Goo”)).click();

The above direction finds the component dependent on the substring of the connection gave in the bracket and therefore partial link text() finds the web component with the predefined substring and afterward taps on it.

  1. How to handle frame in WebDriver?

An inline outline abbreviation as iframe is utilized to embed another record inside the present HTML archive or just a site page into a site page by empowering settling.

Select iframe by id

driver.switchTo().frame(“ID of the casing”);

Finding iframe utilizing tagName

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

Finding iframe utilizing index

frame(index)

driver.switchTo().frame(0);

frame(Name of Frame)

driver.switchTo().frame(“name of the casing”);

frame(WebElement component)

Select Parent Window

driver.switchTo().defaultContent();

  1. How do we use findelement() and findelements() ?

findElement(): findElement() is utilized to locate the primary component in the present site page coordinating to the predefined locator esteem. Take note that the lone first coordinating component would be brought.

Syntax

WebElement component = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

findelements(): find elements() is utilized to discover every one of the components in the present page coordinating to the predefined locator esteem. Take note that all the coordinating components would be brought and put away in the rundown of WebElements.

Syntax

Rundown elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

  1. What is the difference between driver.close() and driver.quit command?

close(): WebDriver’s nearby() strategy shuts the internet browser window that the client is right now taking a shot at or we can likewise say the window that is as a rule presently got to by the WebDriver. The order neither requires any parameter nor does it return any worth.

Quit(): Unlike close() strategy, quit() technique shuts down every one of the windows that the program has opened. Same as close() strategy, the direction neither requires any parameter nor does is return any worth.

  1. Can Selenium handle windows based pop up?

Selenium is a mechanization testing device which underpins just web application testing. Hence, windows spring up can’t be taken care of utilizing Selenium interview questions.

  1. How can we handle web based pop up?

WebDriver offers the clients an effective method to deal with these pop-ups utilizing the Alert interface. There are four techniques that we would use alongside the Alert interface.

void dismiss() – The reject() technique taps on the “Drop” button when the spring up window shows up.

void accept() – The acknowledge() strategy taps on the “alright” button when the spring up window shows up.

String getText() – The getText() technique returns the content showed on the alarm box.

void sendKeys(String stringToSend) – The sendKeys() technique enters the predefined string design into the alarm box.

Syntax:

/tolerating javascript alert

Ready alarm = driver.switchTo().alert();

alert.accept();

  1. How can we handle windows based pop up?

 Selenium is a mechanization testing instrument which underpins just web application testing, which that implies, it doesn’t bolster testing of windows based applications. Anyway, Selenium alone can’t support the circumstance yet alongside some outsider mediation, this issue can be survived. There are a few outsider devices accessible for taking care of window-based pop-ups alongside selenium like AutoIT, Robot class and so

  1. How to retrieve CSS properties of an element?

The estimations of the CSS properties can be recovered utilizing a get() technique:

syntax:

driver.findElement(By.id(“id”)).getCssValue(“name of css property”);

driver.findElement(By.id(“id”)).getCssValue(“font-size”);

  1. What is Junit ?

Junit is a unit testing system presented by Apache. Junit depends on Java.

  1. What are Junit notes

Following are the JUnit Annotations

@Test: Annotation tells the framework that the strategy explained as @Test is a test technique. There can be various test strategies in a solitary test content.

@Before: Method commented on as @Before tells the framework that this strategy will be executed each time before every one of the test techniques.

@After: Method commented on as @After tells the framework that this technique will be executed each time after every one of the test strategy.

@BeforeClass: Method commented on as @BeforeClass tells the framework that this strategy will be executed once before any of the test strategies.

@AfterClass: Method explained as @AfterClass tells the framework that this strategy will be executed once after any of the test techniques.

@Ignore: Method commented on as @Ignore tells the framework that this technique will not be executed.

  1. What is TestNG and how it is better than Junit?

TestNG is a propelled structure planned in a manner to use the advantages by both the designers and analyzers. With the initiation of the systems, JUnit increased colossal fame over the Java applications, Java engineers and Java analyzers with astoundingly expanding the code quality. In spite of being anything but difficult to utilize and clear, JUnit has its restrictions which offer ascent to the need of bringing TestNG into the image. TestNG is an open-source structure that is disseminated under the Apache Software License and is promptly accessible for download.

TestNG with WebDriver gives a proficient and compelling test outcome design that can, thus, be imparted to the partners to have a look at the product’s/application’s wellbeing consequently disposing of the disadvantage of WebDriver’s lack of ability to create test reports. TestNG has an inbuilt special case taking care of instruments which lets the program run without ending suddenly.

Different favorable circumstances make TestNG better than JUnit. Some of them are:

  • Included development and simple explanations
  • Execution examples can set
  • Simultaneous execution of test contents
  • Experiment conditions can be set.

Author: Manu Parameshwaran

0 Reviews

Write a Review

WhatsApp chat

Schedule a demo

We will schedule the demo with an expert trainer as per your time convenience.

Have a query?

we'd love to assist and help you on anything related to IT courses.