Tuesday 19 August 2014

Selenumn interview question


Adobe Selenium question:
  • Different between RC and web driver
  • Page object frame work
  • Handle unwanted pop up
  • Send request to server through RC and web driver
  • Why java is important to coding in web driver not other language 
  • Different Between String and String Buffer
  • Multiple alert accept
Data base question
  • Unique key and primary key different
  •  Different between Inner join and left outer join

Ques 1) What is main difference between RC and webdriver ?                 Manual Testing
Ans- Selenium RC injects javascript function into browsers when the web page is loaded.
Selenium WebDriver drives the browser using browser’s built-in support.
Ques 2) Why you choose webdriver over RC ?
Ans-
a) Native automation faster and a little less prone to error and browser configuration,
b) Does not Requires Selenium-RC Server to be running
c) Access to headless HTMLUnitDriver can allow really fast tests
d) Great API etc.
Ques 3) What is actions class in WebDriver ?
Ans- Actions class is used to control the actions of mouse.
Ques 4) What are oops concepts ?
Ans-
a) Encapsulation,
b) Abstraction,
c) Polymorphism,
d) Inheritance.
Ques 5) What is inheritance ?
Ans- Inherit the feature of any class by making some relations between the class/interface is known as inheritance.
Ques 6) What is difference between overload and override ?
Ans- The methods by passing different arguments list/type is known as overloading of methods while having the same method signature with different method body is known as method overriding.
Ques 7) Does java supports multiple inheritance ?
Ans- Interface supports multiple inheritance but class does not support.
Question 8:  How do I submit a form using Selenium?
Answer:
WebElement el  =  driver.findElement(By.id("ElementID"));
el.submit();
Question 9: How to capture screen shot in Webdriver?
Answer:
File file= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file, new File("c:\\name.png"));
Question 10:  How to execute java scripts function.
Answer:
JavascriptExecutor js = (JavascriptExecutor) driver;
String title = (String) js.executeScript("pass your java scripts");
Question 11:  How to store page source using Selenium 2.0?
Answer:
String pagesource = driver.getPageSource()
Question 12: How to perform drag and drop in selenium 2.0?
Answer:
WebElement source  =  driver.findElement(By.id("Source ElementID"));
WebElement destination  =  driver.findElement(By.id("Taget ElementID"));
Actions builder = new Actions(driver);
builder.dragAndDrop(source, destination ).perform();
13.What is the difference between driver.Close()
 and driver.Quit () method?
Close() - It is used to close the browser or page currently which is having the focus.
Quit() - It is used to shut down the web driver instance or destroy the web driver instance
(Close all the windows)
14. How can we get the font size, font color, 
font type used  for a particular text on a web
page using Selenium web driver?
driver.findelement(By.Xpath("Xpath ").getcssvalue("font-size);
driver.findelement(By.Xpath("Xpath ").getcssvalue("font-colour);
driver.findelement(By.Xpath("Xpath ").getcssvalue("font-type);
driver.findelement(By.Xpath("Xpath ").getcssvalue("background-colour);
15. Is there a way to click hidden LINK in web driver?
String Block1 = driver.findElement(By.id("element ID"));
JavascriptExecutor js1=(JavascriptExecutor)driver;
js1.executeScript("$("+Block1+").css({'display':'block'});");
Ques 16) What are the flavors of selenium ?
Ans- selenium IDE, selenium RC, Selenium WebDriver and Selenium Grid.
Ques 17) What does SIDE stand for?
Ans- Selenumn IDE
Ques 18) selumn disadvantage?
Ans- Tricky setup, test only web application, dreary error dignosis

Enum Types data type in java:-

An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must be equal to one of the values that have been predefined for it. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.
Because they are constants, the names of an enum type's fields are in uppercase letters.
In the Java programming language, you define an enum type by using the enum keyword. For example, you would specify a days-of-the-week enum type as:

 

public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY 
} 
In web driver:- enum DriverType {
              IE, Chrome
         }
Difference between Hashmap and Hashtable.
·        Hashtable is synchronized but Hashmap is not.
·        Hashtable can't contain null values but Hashmap permits null values.

In what all case we have to go for 
“JavaScript executor”..

Consider FB main page after you login. When u scrolls down, the updates get loaded. To
 handle this activity, there is no selenium command. So you can go for javascript to set 
the scroll down value like driver.executeScript("window.scrollBy(0,200)", "");

How to create Hash map and insert the values into it.


Map map= new Hashmap();


Map.put(“one”,1);

Map.put(“two”,2);


Map.put(“three”,3);

Map.add is used for in case of Array list



Difference between Array and ArrayList.
·        Array size is fixed at the time of declaration. We can’t modify it.
·        ArrayList size is not fixed at the time of declaration. We can change its contents.

   Difference between Set and Map.

·        Set – It is also an interface to represent linear collection with no duplicates. Order of insertion is not maintained. Example:- Harshest, Tree Set.
·        Map – It represents an indexed collection i.e. key-value pairs. Example: - Hashmap.
 
 Ques 19) What are difference between Selenium IDE, RC and WebDriver
Selenium IDE
Selenium RC
Selenium WebDriver
It only works in Mozilla browser.
It supports with all browsers like Firefox, IE, Chrome, Safari, Opera etc.
It supports with all browsers like Firefox, IE, Chrome, Safari, Opera etc.
It supports Record and playback
It doesn’t supports Record and playback
It doesn’t supports Record and playback
Doesn’t required to start server before executing the test script.
Required to start server before executing the test script.
Doesn’t required to start server before executing the test script.
It is a GUI Plug-in
It is standalone java program which allow you to run Html test suites.
It actual core API which has binding in a range of languages.
Core engine is Javascript based
Core engine is Javascript based
Interacts natively with browser application
Very simple to use as it is record & playback.
It is easy and small API
As compared to RC, it is bit complex and large API.
It is not object oriented
API’s are less Object oriented
API’s are entirely Object oriented
It doesn’t supports of moving mouse cursors.
It doesn’t supports of moving mouse cursors.
It supports of moving mouse cursors.
Need to append full xpath with ‘xpath=\\’ syntax
Need to append full xpath with ‘xpath=\\’ syntax
No need to append full xpath with ‘xpath=\\’ syntax
It does not supports listeners
It does not supports listeners
It supports the implementation of listeners
It does not support to test iphone/Android applications
It does not support to test iphone/Android applications
It support to test iphone/Android applications

No comments:

Post a Comment