Hexaware – Selenium Interview Questions
Here is the list of Selenium Interview Questions which are recently asked in Hexaware company. These questions are included for both Freshers and Experienced professionals. Our Selenium Training has Answered all the below Questions.
Round 1:
1. Brief me about your automation career
Answer according to your Experience
2. Explain your framework
For example,
The keyword driven framework is used in my project. Keyword Driven Framework in Selenium is a method used for speeding up automated testing by separating keywords for common set of functions and instructions
3. How would you connect to your excel? Which class would you use for it?
4. What is the machine readable format or which class converts any of your document/file into an object?( let me know if you didn’t understand the question.. I can explain)
5. How would you click on a button on which webelement.click doesn’t work?
WebElement element = driver.findElement(By Locators);
element.click();
((JavascriptExecutor) driver).executeScript("return arguments[0].click();", element);
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click(element);
Action action = actions.build();
action.perform();
Round 2:6. Tell me about your career
Answer according to your career and experience
7. Why would you want to leave CogniZant
8. You think your current role isnt challenging?
9. What is the most challenging issue you faced in your project?
For example Some common challenges are:- Sync issue or Timeout
- Complex Programming
- Lack of Transparency
10. What kind of framework u hav used in ur project?
For example:
In my project, I was used for Linear Scripting framework.
Linear Scripting Framework is a basic level test automation framework that is in the form of ‘Record and Playback’ in a linear fashion.
11. Tell me the different tools that u hav used till now in ur project and explain?
- Selenium RC
- Selenium IDE.
- Selenium Grid.
- Selenium Client API
12. Draw and explain the folder structure of ur project and different classes that u hav in each folder?
13. Explain the complete flow of ur code?
14. Draw and explain ur framework?
15. How u ll generate report in different format?
16. Types of reports that u hav used in ur project?
- TestNG
- Junit
- Extent Library
Free PDF : Get our updated Selenium Course Content pdf
17. How to read data from excel sheet using apace poi?
To Read and Write Excel file in Java, Apache provides a very famous library POI. This library is capable enough to read and write both XLS and XLSX file format of Excel.
To read XLS files, an HSSF implementation is provided by POI library.
18. How u will handle multiple windows starting from parent window?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class childWindow {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","./src/resources/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.credosystemz.com/");
// Open new window by clicking the button
driver.findElement(By.id("windowButton")).click();
// Click on the new window element and read the text displayed on the window
WebElement text = driver.findElement(By.id("sampleHeading"));
// Fetching the text using method and printing it
System.out.println("Element found using text: " + text.getText());
driver.quit();
}
}
19. Different types of waits in selenium webdriver and explain it with example?
Implicit wait
Syntax of Implicit wait
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Explicit wait
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),'COMPOSE')]")));
drv.findElement(By.xpath("//div[contains(text(),'COMPOSE')]")).click();
Fluent wait
Wait wait = new FluentWait(WebDriver reference)
.withTimeout(timeout, SECONDS)
.pollingEvery(timeout, SECONDS)
.ignoring(Exception.class);
20. Difference between assert and verify?
Assert | Verify |
---|---|
We use Assert when we have to validate critical functionality. | At times, we might require the test method to continue execution even after the failure of the assertion statements. |
In case of false condition, the next text case of the suite will be executed. | In case of false condition, the next test step of the same text case will continue |
21. Assume we hav a login page, v hav entered login name correctly and entered wrong password and then v tried to login to the application. The password textbox will be highlighted in red color. How u will verify it?
22. Assume u hav a login page, u entered usernameand password correctly and u cliicked login button.Now the application doesn’t
23. Response u aft clikcing on login button… how u ll handle it in ur selenium code?
24. Challenges that u hav faced in selenium?
Most common challenges are,
Selenium supports Web based Applications only, it doesn’t support Desktop Applications/Windows based Applications.
Selenium doesn’t have built-n Object Repository like UFT/QTP to maintain objects/elements in a centralized location, but we can overcome this limitation using Page Object model.
Selenium WebDriver (main tool in selenium’s tool suite) doesn’t have IDE (Integrated development Environment), so we need to write code for every Test step.
Selenium doesn’t have built-in Result Reporting facility, we can overcome this drawback using Testing Framework Assert Methods/Commands or using programming features.
25. Explain with example hw u ll handle file uploads?
package newproject;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class PG9 {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
String baseUrl = "http://demo.guru99.com/test/upload/";
WebDriver driver = new FirefoxDriver();
driver.get(baseUrl);
WebElement uploadElement = driver.findElement(By.id("uploadfile_0"));
// enter the file path onto the file-selection input field
uploadElement.sendKeys("C:\\newhtml.html");
// check the "I accept the terms of service" check box
driver.findElement(By.id("terms")).click();
// click the "UploadFile" button
driver.findElement(By.name("send")).click();
}
}
26. How to full snapshots in chrome browser?
Syntax of snapshots:
File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
27. How to select the drop down value and explain it with example?
package newpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.By;
public class accessDropDown {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
String baseURL = " https://www.credosystemz.com/";
WebDriver driver = new FirefoxDriver();
driver.get(baseURL);
Select drpCountry = new Select(driver.findElement(By.name("country")));
drpCountry.selectByVisibleText("ANTARCTICA");
//Selecting Items in a Multiple SELECT elements
driver.get("http://jsbin.com/osebed/2");
Select fruits = new Select(driver.findElement(By.id("fruits")));
fruits.selectByVisibleText("Banana");
fruits.selectByIndex(1);
}
28. Program to print fibonacci series?
class Main {
public static void main(String[] args) {
int n = 10, firstTerm = 0, secondTerm = 1;
System.out.println("Fibonacci Series till " + n + " terms:");
for (int i = 1; i <= n; ++i) {
System.out.print(firstTerm + ", ");
// compute the next term
int nextTerm = firstTerm + secondTerm;
firstTerm = secondTerm;
secondTerm = nextTerm;
}
}
}
Output
Fibonacci Series till 10 terms:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34,
29. Have u worked in SOAP UI, if so tell me what will u do with that?
SOAPUI can be integrated with Selenium for enhancing functionalities. The simplest and easiest way to integrate Selenium with SOAPUI is to use ‘Groovy’. SOAPUI completely supports Groovy.
30. Have u developed any framework?
31. Explain mouseover actions with example
package com.toolsqa.tutorials.actions;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
public class MouseHover1 {
public static WebDriver driver;
public static void main(String[] args) {
//Set system properties for geckodriver This is required since Selenium 3.0
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\Toolsqa\\lib\\geckodriver.exe");
// Launch the URL
driver.get("https://demoqa.com/menu/");
System.out.println("demoqa webpage Displayed");
//Maximise browser window
driver.manage().window().maximize();
//Adding wait
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
//Instantiate Action Class
Actions actions = new Actions(driver);
//Retrieve WebElement 'Music' to perform mouse hover
WebElement menuOption = driver.findElement(By.xpath(".//div[contains(text(),'Music')]"));
//Mouse hover menuOption 'Music'
actions.moveToElement(menuOption).perform();
System.out.println("Done Mouse hover on 'Music' from Menu");
//Now Select 'Rock' from sub menu which has got displayed on mouse hover of 'Music'
WebElement subMenuOption = driver.findElement(By.xpath(".//div[contains(text(),'Rock')]"));
//Mouse hover menuOption 'Rock'
actions.moveToElement(subMenuOption).perform();
System.out.println("Done Mouse hover on 'Rock' from Menu");
//Now , finally, it displays the desired menu list from which required option needs to be selected
//Now Select 'Alternative' from sub menu which has got displayed on mouse hover of 'Rock'
WebElement selectMenuOption = driver.findElement(By.xpath(".//div[contains(text(),'Alternative')]"));
selectMenuOption.click();
System.out.println("Selected 'Alternative' from Menu");
// Close the main window
driver.close();
}
}
32. You hav a web table it contains 3 columns. 1st column contains name of a person and 3rd column contains out time. U need To print out time of a particular person name. Assume that the values in changing dynamically.
Book a Free Mock Interviews and Test your Selenium skills with our Experts
TOP MNC's SELENIUM INTERVIEW QUESTIONS & ANSWERS
Here we listed all Selenium Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Selenium.
Related Blogs
To become a Selenium Certified professional and join in your dream company, Enroll now for our Best Selenium Training. We help you to crack any levels of Selenium Interviews and We offering Selenium Training with Placement Assistance.