• +91 9723535972
  • info@interviewmaterial.com

Selenium Interview Questions and Answers

Selenium Interview Questions and Answers

Question - 11 : - What is the difference between verify and assert commands?

Answer - 11 : -

Assert:  Assert allows to check whether an element is on the page or not. The test will stop on the step failed, if the asserted element is not available. In other words, the test will terminated at the point where check fails.

Verify: Verify command will check whether the element is on the page, if it is not then the test will carry on executing.  In verification, all the commands are going to run guaranteed even if any of test fails.

Question - 12 : - What is JUnit Annotations and what are different types of annotations which are useful ?

Answer - 12 : -

In JAVA a special form of syntactic meta-data can be added to Java source code, this is know as Annotations.  Variables, parameters, packages, methods and classes are annotated some of the Junit annotations which can be useful are

  • Test
  • Before
  • After
  • Ignore
  • BeforeClass
  • AfterClass
  • RunWith

Question - 13 : - While using click command can you use screen coordinate?

Answer - 13 : -

To click on specific part of element, you would need to use clickAT command.  ClickAt command accepts element locator and x, y co-ordinates as arguments-

clickAt (locator, cordString)

Question - 14 : - What are the advantages of Selenium?

Answer - 14 : -

  • It supports C#, PHP, Java, Perl, Phython
  • It supports different OS like Windows, Linux and Mac OS
  • It has got powerful methods to locate elements (Xpath, DOM , CSS)
  • It has highly developer community supported by Google

Question - 15 : - Why testers should opt for Selenium and not QTP?

Answer - 15 : -

Selenium is more popular than QTP as

  • Selenium is an open source whereas QTP is a commercial tool
  • Selenium is used specially for testing web based applications while QTP can be used for testing client server application also
  • Selenium supports Firefox, IE, Opera, Safari  on operating systems like Windows, Mac, Linux etc. however QTP is limited to Internet Explorer on Windows.
  • Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script

Question - 16 : - What are the four parameter you have to pass in Selenium?

Answer - 16 : -

Four parameters that you have to pass in Selenium are

  • Host
  • Port Number
  • Browser
  • URL

Question - 17 : - What is the difference between setSpeed() and sleep() methods?

Answer - 17 : -

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

Question - 18 : - What is same origin policy? How you can avoid same origin policy?

Answer - 18 : -

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

Question - 19 : - What is heightened privileges browsers?

Answer - 19 : -

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.

Question - 20 : - How you can use “submit” a form using Selenium ?

Answer - 20 : -

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


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners