Software testingΒ play
vital role in software industry find bugs and error before launch software in
market.
There is still lot of demand for
people with skills relevant to manual testing. Number of MNC Company hire
fresherΒ BE/BTECH/MSC/MCA/BCAΒ candidate for software testing with 3 to
4 LPA. This blog help you Build career in software testing. There are all questions
important for interview preparation. We also post lot of vacancy in our websiteΒ www.campusjobs4u.com.
Two main type of testing
1. Manual Testing. (2 LPA to
5LPA)
2. Automation Testing.(3.50
LPA to 7 LPA)
Letβs begin by taking a look at the most frequently asked Automation Testing Interview Questions.
Automation Testing Frequently ask and Very Important Interview Questions and Answer Download Now Only at 21 RsΒ and Manual Testing 30 Rs + Free Job Updates still placementΒ
Automation Testing PDFΒ Β Β Download HereΒ
Manual Testing PDFΒ Β Β Β Β Β Β Β Download HereΒ
Ques 1)Β What are the annotations used in
TestNG ?
Ans: @Test, @BeforeSuite, @AfterSuite,
@BeforeTest, @AfterTest, @BeforeClass, @AfterClass, @BeforeMethod,
@AfterMethod.
Ques 2) How do you read data from excel ?
FileInputStream fis = new FileInputStream(βpath
of excel fileβ);
Workbook wb = WorkbookFactory.create(fis);
Sheet s = wb.getSheet(βsheetNameβ);
String value = s.getRow(rowNum).getCell(cellNum).getStringCellValue();
Ques 3)Β What is the use of xpath ?
Ans- it is used to find the WebElement in web page. It is very useful to identify the dynamic web elements.
Ques 4)Β What are different types of locators
?
Ans- There are 8 types of locators and all are
the static methods of the By class.
By.id(), By.name(), By.tagName(),
By.className(), By.linkText(), By.partialLinkText(), By.xpath,
By.cssSelector().
Ques 5)Β What is the difference between Assert
and Verify?
Ans- Assert- it is used to verify the result.
If the test case fail then it will stop the execution of the test case there
itself and move the control to other test case.
Verify- it is also used to verify the result.
If the test case fail then it will not stop the execution of that test case.
Ques 6)Β What is the alternate way to click on
login button?
Ans- use submit() method but it can be used
only when attribute type=submit.
Ques 7)Β How do you verify if the
checkbox/radio is checked or not ?
Ans- We can use isSelected() method.
Syntax -
driver.findElement(By.xpath("xpath of the
checkbox/radio button")).isSelected(); |
Ques 8)Β How do you handle alert pop-up ?
Ans- To handle alert pop-ups, we need to 1st
switch control to alert pop-ups then click on ok or cancle then move control back
to main page.
Syntax-
Β |
String mainPage = driver.getWindowHandle(); 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. |
Ques 9)Β How do you launch IE/chrome browser?
Ans- Before launching IE or Chrome browser we
need to set the System property.
Β |
//To open IE browser
|
|
Β |
//To open Chrome browser β
|
Ques 10)Β How to perform right click using
WebDriver?
Ans- Use Actions class
Β |
Actions act = new Actions(driver);
|
Β |
Β Actions act = new Actions(driver); Β WebElement source = driver.findElement(By.xpath(β -----β));Β Β Β //source ele which you want to drag Β WebElement target = driver.findElement(By.xpath(β -----β));Β Β //target where you want to drop Β act.dragAndDrop(source,target).perform(); |
Ques 12)Β Give the example for methodΒ
Β overload in WebDriver.
Ans- frame(string), frame(int),Β
Β frame(WebElement).
Ques 13)Β How do you upload a file?
Ans- To upload a file we can use sendKeys()
method.
|
driver.findElement(By.xpath(βinput fieldβ)).sendKeys(βpath Β of the fileΒ which u want to uploadβ); |
itemΒ in a drop down menu?
Ans- If that menu has been created byΒ
using select tag then we can use theΒ
methods selectByValue() or selectByIndex()Β
or selectByVisibleText().Β
These are the methods of the Select class.
If the menu has not been created byΒ
using the select tag then we can simply
Β find the xpath of that element and click on
that to select.
Ques 15)Β How do you simulate browserΒ
back and forward ?
|
Β driver.navigate().back(); Β driver.navigate().forward(); |
URL ?
|
driver.getCurrentUrl(); |
Download Now!! Frequently ask interview question and answer π |