Selenium Interview Question-1

1) What are the four parameter you have to pass in Selenium? Four parameters that you have to pass in Selenium are
·         Host
·         Port Number
·         Browser
·         URL
2) What is the difference between setSpeed() and sleep() methods?
Both will delay the speed of execution.
Thread.sleep () :  It will stop the current (java) thread for the specified period of time.  Its done only once
·         It takes a single argument in integer format
Ex: thread.sleep(2000)- It will wait for 2 seconds
·         It waits only once at the command given at sleep
SetSpeed () :  For specific amount of time it will stop the execution for every selenium command.
·         It takes a single argument in integer format
Ex: selenium.setSpeed(“2000”)- It will wait for 2 seconds
·         Runs each command  after setSpeed delay by the number of milliseconds mentioned in set Speed
This command is useful for  demonstration purpose or if you are using a slow web application
3) What is same origin policy? How you can avoid same origin policy?
The “Same Origin Policy” is introduced for security reason, and it ensures that content of your site will never be accessible by a script from another site.  As per the policy, any code loaded within the browser can only operate within that website’s domain.
To avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy , which sits between the browser and application under test and then masks the AUT under a fictional URL
4) What is heightened privileges browsers?
The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that are not commonly permitted.  The key difference is that the browsers are launced in a special mode called heightened privileges.  By using these browser mode, Selenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.
5) How you can use “submit” a form using Selenium ?
You can use “submit” method on element to submit form-
element.submit () ;
Alternatively you can use click method on the element which does form submission
6) What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?
TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from unit testing to integration testing. And the functionality which makes it efficient testing framework are
·         Support for annotations
·         Support for data-driven testing
·         Flexible test configuration
·         Ability to re-execute failed test cases
7) Mention what is the difference between Implicit wait and Explicit wait?
Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount of time it will try looking for element again and again before throwing a NoSuchElementException.  It waits for elements to show up.
Explicit Wait :  It is a one-timer, used for a particular search.
8) Which attribute you should consider throughout the script in frame for “if no frame Id as well as no frame name”?
You can use…..driver.findElements(By.xpath(“//iframe”))….
This will return list of frames.
You will ned to  switch to each and every frame and search for locator which we want.


Comments

Popular posts from this blog

Handling Dynamic Web Tables Using Selenium WebDriver

Verify Specific Position of an Element

Read it out for TESTNG before going for an iterview