Bank of America – Selenium Interview Questions
Here is the list of Selenium Interview Questions which are recently asked in Bank of America company. These questions are included for both Freshers and Experienced professionals. Our Selenium Training has Answered all the below Questions.
Round 1:
1. Tell about yourself
Answer according to your profile and experience
2. Explain your experience in Automation
Answer according to your project and experience.
3. Role in Automation
Answer According to your profile.
4. Write a program for registration page : Click on register link in web page. Then fill all the fields with external data source. Finally click on submit.
import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
public class Register extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String n=request.getParameter("userName");
String p=request.getParameter("userPass");
String e=request.getParameter("userEmail");
String c=request.getParameter("userCountry");
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","oracle");
PreparedStatement ps=con.prepareStatement(
"insert into registeruser values(?,?,?,?)");
ps.setString(1,n);
ps.setString(2,p);
ps.setString(3,e);
ps.setString(4,c);
int i=ps.executeUpdate();
if(i>0)
out.print("You are successfully registered...");
}catch (Exception e2) {System.out.println(e2);}
out.close();
}
}
5. Explain each and every line. what it will do [4]?
6. In the same scenario[4] , how you read the data for 10 different test data?
7. How to get count of all the links in web page?
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class LinkCount {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String url = " https://www.credosystemz.com/";
driver.get(url);
driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
//Using tagname with anchor
List links = driver.findElements(By.tagName("a"));
System.out.println(“The number of links is “ + links.size());
driver.close();
}
8. How to read the data from Notepad?
package com.qa.practice;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ReadingNotepadData {
public static void main(String[] args) throws IOException {
String TestFile = "C:\\Users\\ajain153\\Desktop\\testdata.txt";
FileReader FR = new FileReader(TestFile);
BufferedReader BR = new BufferedReader(FR);
String Content = "";
//Loop to read all lines one by one from file and print It.
while((Content = BR.readLine())!= null){
System.out.println(Content);
System.setProperty("webdriver.chrome.driver", "C:\\Automation\\chromedriver_win32_2\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(Content);
String Tittle=driver.getTitle();
System.out.println("Tittle of Page is"+ Tittle);
}
}
}
9. How to read the file which is present in Network?[Like SharePoint]
10. Explain manual testing cycle from requirement
Requirement Phase Testing also known as Requirement Analysis in which test team studies the requirements from a testing point of view to identify testable requirements and the QA team may interact with various stakeholders to understand requirements in detail.
Requirements could be either functional or non-functional. Automation feasibility for the testing project is also done in this stage.
11. Defect Life cycle
Defect life cycle, also known as Bug Life cycle is the journey of a defect cycle, which a defect goes through during its lifetime. It varies from organization to organization and also from project to project as it is governed by the software testing process and also depends upon the tools used.
12. How to instantiate Chrome driver?
System.setProperty("webdriver.chrome.driver","D:/your/path/to/Driver/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com");
13. Did you attend any Client calls from Onsite?
14. What is Maven, Git, Jenkins?
Maven:
It is the most important tool in the development, it provides developers a complete build lifecycle framework. It is used to check the compilation issues between framework components whenever multiple test engineer integrates their files into the same framework
Git is a Distributed Version Control System for tracking versions of files. Git allows you to track versions of your code in your local machine. However, if you want a remote backup of your code or want to publish your code to a community then you’ve to push it to Github
Jenkins
Jenkins can be configured to email the content of the status of the build. Jenkins can be configured to distribute the build on multiple machines.
Project build: Jenkins documents the details of jar, version of jar and mapping of build and jar numbers.
15. Limitations of Selenium
- We cannot test mobile apps
- Limited reporting
- Handling dynamic Elements
- Handling page load
16. Write a code for taking screenshot
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.File;
import java.io.IOException;
public class ScreenshotDemo {
public static void main(String[] args) {
//set the location of chrome browser
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
// Initialize browser
WebDriver driver = new ChromeDriver();
//navigate to url
driver.get("https://demoqa.com");
//Take the screenshot
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
//Copy the file to a location and use try catch block to handle exception
try {
FileUtils.copyFile(screenshot, new File("C:\\projectScreenshots\\homePageScreenshot.png"));
} catch (IOException e) {
System.out.println(e.getMessage());
}
//closing the webdriver
driver.close();
}
}
17. How to handle Alert?
Alert alt = driver.switchTo().alert(); // to move control to alert popup
alt.accept(); // to click on ok.
alt.dismiss(); // to click on cancel.
//Then move the control back to main web page-
driver.switchTo().window(mainPage); → to switch back to main page.
18. How to handle multiple windows?
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://demoqa.com/browser-windows");
// 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. Annotations in TestNg
Annotation is a feature in Java that is used to add metadata to Java source. It was introduced in Java 1.5 version. It can be applied to classes, methods, variables, and parameters.
Free PDF : Get our updated Selenium Course Content pdf
20. Hierarchy of TestNg
TestNG hierarchy package for classes. TestNg Annotations are,- @Beforesuite
- @Aftersuite
- @BeforeClass
- @AfterClass
21. Difference bw ‘Defect Retesting’ and ‘Regression Testing’
Defect Retesting | Regression Testing |
---|---|
Involves testing a specific feature of the software. | Involves testing a general area of the software. |
To ensure that the defects which were found and posted in the earlier build were fixed or not in the current build. | Repeated testing of an already tested program, after modification, to discover any defects introduced or uncovered as a result of the changes in the software being tested. |
22. Do u know Database testing?
The Java Database Connectivity (JDBC) API provides universal data access from the Java programming language. Using the JDBC API, you can access virtually any data source, from relational databases to spreadsheets and flat files.
23. Which project is in which domain?
24. If u have 100 scenarios. In that u have mixture of smoke and sanity scenarios. want to run smoke alone. How to handle this with TestNg.
25. What are the reports u r maintaining?
Round 3:26. Tell me about yourself
Answer is according to your profile.
27. What are the annotations available in TestNG?
Below are the few important annotations in TestNG- BeforeSuite.
- BeforeTest.
- BeforeClass.
- BeforeMethod.
- Test Case.
- AfterMethod.
- AfterClass.
- AfterTest
28. One question on when to use ‘Success percentage’ attribute in TestNG
29. Explain Defect Lifecycle
30. Sceniario: clicking on a link in a Window will take you to another window.i want to click a link in another window.
31. How will you do that?
32. What are locaters available in Selenium? Which is the least prepared, most prepared & how?
- By CSS ID: find_element_by_id
- By CSS class name: find_element_by_class_name
- By name attribute: find_element_by_name
- By DOM structure or xpath: find_element_by_xpath
- By link text: find_element_by_link_text
- By partial link text: find_element_by_partial_link_text
- By HTML tag name: find_element_by_tag_name
33. What are the challenges you faced in selenium?
- Top most Challenges in selenium projects are
- Not test Windows app
- Pop-up Windows
- False Positives & False Negatives
- Limited Reports
34. What is the report used in your project?
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.