Monday, April 13, 2020

Interview Questions

How to extract date values in a string
-          How to use Listeners in framework. Ex: in order to insert test results in DB during runtime, what is the best way to do so
-          Tell me about collections
-          What are diff ways of passing parameters in feature file
-          Have you used TestNG, and why do we use it
-          There are date and timestamp(AM and PM format) values in a data table, how do you sort table rows while reading the cells
-          What are the challenges you have faced in project for selenium programming
-          What are mostly used OOPS concepts In your project

Apple interview:
1. Hashmap vs Hashtable
2. How to access or store data from excel employee records to java collections
3. Reflection in java
4. Different status codes  --- 401 unatuth, 403 -- forbidden, 415 - media format not supported
5. Runtime Exceptions vs compile time exceptions   -- file not found is what exception?
6. why main is public, static   -- So that jvm can access it. 
6.1 why main has String args[] parameters --- because when you create jar java application, you could pass parameters when running the jar file ex: java -jar myapplication.jar "a" "b". When you print args[0] and args[1] in main method, you will get a and b respecitively when main method is executed.
7. jar vs war. How to create Jar file, and what it contains. How to say where is main method if you have multiple class files when you create jar files. ...
jar --- is zip of java classes and resources. Java archive. Command used to create (go to the directory where you have java files): > jar -cf name.jar *.java 
7.1 How to use jar file
8. importance of maven  -- command like mvn clean verify
9. Desired capabilities
10. Browser profiling
11.Errors vs Exception  -- Errors caused by other than application-- like outofmemory, stackoverflow etc. Exception is due to application
12. Using Testng we add respective class which we wanted to test. But when we have new classes that are getting added instead of keep adding classes to testng is there a way to run entire suite
13.  mvn clean install vs mvn clean verify
14. What does final mean for a method   --- methods will final keyword cannot be overriden by subclasses
A class with final keyword means it cannot be extended.

role of JavaScript in selenium web automation testing

We use JavaScript to at two places as of now in web automation testing with selenium:

Interface JavaScriptExecutor in java will help to use execute javascript code in selenium

Scenarios where we use JavaScript:

1. To enter value in input field without using .sendkeys  method

2. To use arguments[0].ScrollToView   -- which scrolls to the element on the webpage

public void ScrollclickJS(WebElement we) {
              JavascriptExecutor executor = (JavascriptExecutor) driver.getWebDriver();
              executor.executeScript("arguments[0].scrollIntoView();"we);
              executor.executeScript("arguments[0].click();"we);
       }