Tech Mahindra – Selenium Interview Questions
Here is the list of Selenium Interview Questions which are recently asked in Tech Mahindra company. These questions are included for both Freshers and Experienced professionals. Our Selenium Training has Answered all the below Questions.
1. Tell me about yourself
The perfect way to answer tell me yourself is to make sure you succinctly and clearly explain how you are suited for this particular job and why you want it in that company.
Most important, you start crafting your selling points, spend some time reviewing the job description in the recruitment ad for the role and researching the company.
On the other hand, prepare a short script that highlights your post relevant abilities, strengths and areas of expertise. Also, follow that with the reasons you are applying for the job, focusing on career-related motivations.
2. What is the framework you used in your project?
Below is the important framework in software testing,- Linear Automation Framework
- Modular Driven Framework
- Behavior Driven framework
- Data-Driven Framework
- Keyword-Driven Framework
- Hybrid Testing Framework
3. What is difference between hybrid and data driven frame work?
Data Driven FrameworkThe technique of separating the “data set” from the actual test case which is called as Data driven framework in selenium. Data driven framework completely depends on the input test data. The test data is fed from external sources such as an excel file, .CSV file or any database.
Hybrid frameworkHybrid framework is a technique, you can make the best use of both Data Driven & Keyword Driven Selenium framework . We can build a Hybrid framework for storing the methods to execute in an excel file. Also passing these method names to the Java Reflection Class instead of creating an If/Else loop in the “DriverScript” class.
4. Can we run multiple suites using Test NG.xml?
Yes,You can add multiple tests in testngSuite and execute in selenium.
5. What type of annotations we use?
Types of Annotations- Predefined annotations
- Custom annotations
- Meta-annotations
6. Explain about grouping in testng?
Performing the grouping of different test methods which is allow the TestNG groups.
Grouping of test methods is required when you want to access the test methods of different classes. Not only you can declare the methods within a specified group, you can also declare another group within a specified group
7. What is Data Provider?
The important feature of TestNG for testing is Data Provider. Thease are a framework for which is easily controlling how data can be provided from a source Such as be fast and efficient by allowing narrow queries that provide only specified amounts of data from specified locations.
8. What is Selenium Grid?
Selenium Grid is defined by allows the execution of WebDriver scripts on remote machines by routing commands sent by the client to remote browser instances. The goal of using the Selenium Grid is to provide an easy way to run tests in parallel on multiple machines.
9. Firefox Driver is class or an interface and from where is it inherited?
It is a class, which is derived from WebDriver interface
10. What is the use of get Options () method?
Uses:- We can extract all the options in a dropdown in Selenium.
- get Options () method method does not accept any arguments.
- It is used to retrieves all the options on a Select tag.
- Also, returns a list of web elements
11. How do u get the attribute of the web element?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class GetSrcAttribute{
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\credo\\Desktop\\Java\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String u = "https://www.tutorialspoint.com/about/about_careers.htm"driver.get(u);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
// identify element
WebElement t=driver.findElement(By.xpath("//img[@class='tp-logo']"));
// get src attribute with getAttribute()
System.out.println("Src attribute is : " + t.getAttribute("src"));
driver.close();
}
}
12. How does u get the width of the textbox?
Free PDF : Get our updated Selenium Course Content pdf
13. What type of group concepts you use?
Types of groups- Formal group
- Command group
- Committees
- Informal groups
14. Difference between Method Overloading and Method Overriding?
Method Overloading The main concept of method overloading is to allows the method to have the same name which differs on the basis of arguments or the argument types. Method overloading can be related to compile-time polymorphism.
Method Overriding
Method overloading used to gives us the liberty to not define a function again and again for doing the same thing.
For example, the two methods are basically performing division, so we can have different methods with the same name but with different parameters. It also helps in compile-time polymorphism.
15. Test Plan and Test Strategy
In testing documentation test plan and test strategy are important part. Following are the difference between the test plan and test strategy,
Test Plan | Test Strategy |
---|---|
Test plan is describes about the details. | It is describes about the general methodologies. |
Perform Independently | often found as a part of a test plan. |
A test plan can be changed. | While test strategy usually not changed |
It is prepared by the test lead or test manager. | It is generally prepared by the project manager. |
Test plan utilized at the project level. | While test strategy is utilized at the association level. |
A test plan is specific to a particular project. | A test strategy is usually for a complete organization. |
16. Can we run multiple suites using TestNG?
Parallel execution is used to run multiple suites for TestNG, it enables the run test methods. In different thread execution the execution time is reduced for this parallel execution.
17. Explain about Data Providers in TestNG?
The Data Providers is described to TestNG the way to pass the parameters in the test function.
In short, DataProviders are means to pass different values to the TestNG Test Case in a single execution and in the form of TestNG Annotations. It is a part of the inbuilt TestNG data-driven testing for which TestNG is quite popular.
18. Interface and Abstract Method
Interface | Abstract Method |
---|---|
Speed is slow | Speed is fast |
The structure of interface is Abstract methods | The structure of abstract method is Abstract & concrete methods |
It is used for Future enhancement | It is used to avoid independence |
The interface cannot contain data fields. | Abstract the class can have data fields |
Class type is only public abstract methods. | An abstract class has protected and public abstract methods. |
Interface cannot have access Modifiers | Abstract Class can have an access modifier. |
19. How to take Screenshot in WebDriver which method we need to use?
You can use 3 steps for take screenshot in webdriver- Convert web driver object to TakeScreenshot
- Call getScreenshotAs method to create image file
- Copy file to Desired Location
20. What is a Framework?
A framework is also called software framework, which is a platform for developing software applications. It provides a foundation on which software developers can build programs for a specific platform.
A framework is similar to an application programming interface (API), though technically a framework includes an API.
21. What are the advantages of selenium WebDriver?
Listed few important benefits of Selenium WebDriveris given below,- Selenium WebDriver is a platform-independent tool, so that you can execute the testing on multiple platforms, such as Windows, Mac, or Linux operating systems.
- You can access the different browsers, such as Chrome, Firefox, Internet Explorer, Opera, etc.
- It is not limited to any one of the programming languages. You can write and conduct the testing using Java, PHP, Ruby, Python, C#, .Net, and Perl.
- On the other hand, you can get detailed reports and case management,
- Importantly, you can integrate various tools such as JUnit and TestNG.
- Also, it can be integrated with Docker, Maven, and Jenkins.
22. How to invoke an application in WebDriver?
driver.get(“url”); or driver.navigate().to(“url”); 1
driver.get(“url”); or driver.navigate().to(“url”);
23. How to check whether a text is underlined or not?
Use the below code to find whether a text is underlined or not,
public class UnderLine {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.google.co.in/?gfe_rd=ctrl&ei=bXAwU8jYN4W6iAf8zIDgDA&gws_rd=cr");
String cssValue= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");
System.out.println("value"+cssValue);
Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.xpath("//a[text()='Hindi']"))).perform();
String cssValue1= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");
System.out.println("value over"+cssValue1);
driver.close();
}
}
24. How to hover the mouse on an element?
Refer the below code for hover the mouse on an element,
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 org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import java.util.concurrent.TimeUnit;
public class MouseOver{
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Credo\\Desktop\\Java\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String url = " https://www.credosystemz.com/";
driver.get(url);
driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
// actions class with moveToElement() method for mouse hover to element
Actions a = new Actions(driver);
a.moveToElement(driver.findElement(By.xpath(“input[@type=’text’]))).
build().perform();
driver.quit();
}
}
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.