Ques-1. What is the framework used in the company ?
Ans- Hybrid Driven Framework (you can tell according to your project.).
Ques 2. How do you perform string concatenation ?
Ans- Using plus (+) operator.
ex- String a = "tcs";
String b = "tata"
String concatenated = a+b; // tcstata
Ques 3. How will you check result of your test script ?
Ans- In testng report we can check. There are many other ways like we can also write test result in excel file. To verify result we use Assert.assertEquals(). Result can we verify by text, webelement or title of the page etc.
Ques 4. What are the wait commands used in test scripts ?
Ans- driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //this will wait for 5sec, implicit wait
explicit wait- WebDriverWait or Thread.sleep() , we can use as per req.
Ques 5. What is the difference between implicit wait and explicit wait ?
Ans- sychronizing-webdriver-implicit-wait.html
Ques 6. What is the difference between implicit wait and thread.sleep ?
Ans- Implicit and Explicit wait
Ques 7. What are the advantages of TestNG ?
Ans- 1) lots of annotations which are easy to remember,
2) order of execution can be changed,
3) 3 kinds of report generated,
4) parallel execution possible,
5) failed test cases can be executed separately etc.
Ques 8. What are annotations used ?
Ans-@BeforeSuite,
@AfterSuite,
@BeforeTest,
@AfterTest,
@BeforeClass,
@AfterClass,
@Test,
@BeforeMethod,
@AfterMethod etc.
9. How @After, @Test,@Before gets executed explain ?
Ans- The method written under @Before, will execute everytime before @Test and
the method written under @After, will execute everytime after @Test.
Flow- @Before -> @Test -> @After
Ques 10. How will you check whether the expected text appears on the webpage. what are the command used ?
Ans- We can write the xpath for that particular element where text is expected then use getText() method to get the text of that particular element. And use the Assert.assertEquals(exp,act) method to verify the result.
Ques 11. What are the selenium jar files you know ?
Ans- There are many but basically he want to here - selenium-server-standalone-version.jar
ex- selenium-server-standalone-2.42.0.jar, selenium-server-2.42.0.jar etc.
Ques 12. How do you take screenshot when any test case fails.write a program ?
Ans-
try{
Assert.assertEquals(exp,act);
}catch(Exception e){
File
scrFile = ((TakesScreenshot)driver).getScreenshot As
(OutputType.FILE);
FileUtils.copyFile(scrFile,
new File(“destination screenshot path”));
}