Selenium Webdriver Interview Questions

Selenium IDE Basics

  1. What is Selenium IDE ?

    1. Selenium IDE (Integrated Development Environment) is an ideal tool used to develop selenium test scriptsIf you are getting a message, “Video is Unavailable” it means that the loading of the video is timing out. It’s almost and always related to a client connection problem.
    2. Which allows us to record user actions on browser window.
    3. It operates as a Mozilla Firefox add on and provides an easy to use interface for developing and running individual test cases or entire test suites.
    4. An open source functional automation tool.
    5. All of the above

    Ans: 5

  2. How do you open/start selenium-ide after installation ?

    1. Goto Start > All Programs > Selenium IDE
    2. First launch/open firefox browser and then click on ‘Tools’ tab in the menu bar and click Selenium IDE
    3. Click Shortcut option on the Desktop
    4. None of the above

    Ans: 2

  3. Features of selenium IDE ____

    1. Its main feature is record and playback
    2. Identifies element using id, name, xpath etc
    3. It has an option of asserting title of every page automatically
    4. It has a feature of exporting testcase/suite into different formats like C#, Java, Ruby, Python
    5. All of the above

    Ans: 5

  4. Selenium IDE runs in ____ browser

    1. Chrome
    2. IE 8
    3. Safari
    4. Firefox
    5. Netscape

    Ans: 4

  5. Selenium IDE can execute scripts created in ____

    1. Selenese only
    2. JAVA
    3. C#
    4. Ruby
    5. Python

    Ans: 1

  6. Selenium IDE can not upload files.

    1. TRUE
    2. FALSE

    Ans: 1

  7. Selenium IDE directly does not support Loops and Conditions

    1. TRUE
    2. FALSE

    Ans: 1

  8. Selenium IDE can read external files like ….

    1. .txt files
    2. .csv files
    3. Can’t read
    4. .xls files
    5. None of the above

    Ans: 3

  9. Selenium _____ are the way of finding HTML element on the page to perform Selenium actions

    1. xpath
    2. locators
    3. element id
    4. None of the above

    Ans: 2

  10. We use ____(for firefox) to identify elements

    1. Object Spy
    2. HTML DOM
    3. xpath
    4. Firebug

    Ans: 4

  11. What is selenese ?

    1. Selenium set of commands
    2. A type of language
    3. Scripting language
    4. All of the above

    Ans: 1

  12. ____ is used when the expected value is mandatory to continue with next set of steps

    1. Verify
    2. WaitForText
    3. C#
    4. Assert
    5. VerifyText

    Ans: 3

  13. ____ is used when the expected value is optional to continue with the next set of steps

    1. Verify
    2. Assert
    3. VerifyText
    4. WaitForText

    Ans: 1

  14. Can tests recorded using Selenium IDE be run in other browsers?

    1. Yes
    2. No

    Ans: 1

  15. What kind of application is the Selenium IDE?

    1. Windows Application
    2. Web application
    3. Firefox add-on
    4. None of the above

    Ans: 3

  16. A Selenium IDE test case has three columns, Command, Target and Value. What data is stored in the Target column?

    1. Element or location where the command is executed
    2. Test step execution result
    3. [Optional] purpose of the test step
    4. None of the above

    Ans: 1

  17. By default, in which format does the Selenium IDE save a test case?

    1. In proprietary format
    2. As HTML
    3. As Java source code
    4. As Ruby or Python or C# code depending on user options selected during installation

    Ans: 2

  18. What features are available in Selenium IDE to debug an automated test case?

    1. Toggle Breakpoint
    2. Pause/ Resume
    3. Step
    4. All of the above

    Ans: 4

  19. What is the Selenium print command?

    1. echo
    2. print
    3. alert
    4. System.out.println()

    Ans: 1

  20. What is the difference between a command and the same command with “AndWait” (e.g. click and clickAndWait commands)?

    1. Selenium waits indefinitely for the result of the “AndWait” command.
    2. It waits for the result of the “AndWait” command but only for 30 seconds (default timeout).
    3. It waits for the result of the “AndWait” command but only up to a maximum of 30 seconds (default timeout).
    4. Some commands do not have an “AndWait” command, so this question is incorrect.

    Ans: 3

  21. What is the correct syntax to access the value of a Selenium variable called name?

    1. name
    2. $name
    3. {name}
    4. ${name}

    Ans: 4

  22. In which associative array does Selenium store all of a test case’s variables and their respective values?

    1. Array
    2. storedVars
    3. var
    4. There is no such array in Selenium.

    Ans: 2

  23. Where can you create your own Selenium commands?

    1. This is not possible.
    2. In user-extensions.js file
    3. In any JavaScript file, but the preferred name is user-extensions.js for consistency
    4. In any Java, C#, Python, Ruby, PHP or Perl file

    Ans: 3

  24. What is the purpose of the Find button?

    1. Highlight the element that is given in the locator
    2. Search the appropriate command for the given target
    3. Find the current value of the target
    4. None of the above

    Ans: 1

  25. Why are relative XPaths preferred over absolute XPaths as locators?

    1. For non-root elements, absolute XPaths are longer and slow down the test automation.
    2. Absolute XPaths fail if any part of the path changes even slightly.
    3. Relative XPaths are the default in Selenium.
    4. None of the above

    Ans: 2

  26. What is the best way to handle asynchronous data retrieval from the server as in AJAX applications?

    1. Run the test case at the slowest speed.
    2. Use the pause command.
    3. Use the “AndWait” commands.
    4. Use the “waitFor” commands.

    Ans: 4

  27. What happens when the application creates a JavaScript alert during test case play?

    1. The alert is suppressed by Selenium..
    2. If there is no command to handle the alert, the play is stopped with an error.
    3. If the alert is handled with assertAlert, assertAlertPresent or verifyAlert, no alert is displayed and there is no error.
    4. All of the above

    Ans: 4

Selenium IDE Basics

  1. What is Selenium RC?

    1. Selenium RC starts up browsers(one at a time) and then runs commands we pass along from our tests
    2. It allows us to use a programming language for maximum flexibility and extensibility in developing test logic
    3. It provides an API and library for each of its supports languages like Java, Ruby, Python, Perl and C#
    4. All of the above

    Ans: 4

  2. Selenium RC components are ___ Selenium server Client libraries

    1. Selenium
    2. Grid
    3. Both
    4. 1 & 2

    Ans: 4

  3. Selenium Server launches and kills browser

    1. TRUE
    2. FALSE

    Ans: 1

  4. ____ provide the interface between each programming language and the Selenium RC server

    1. Selenium RC
    2. Client libraries
    3. Selenium Server
    4. None of the above

    Ans: 2

  5. Why selenium RC is used ?

    1. Used to automate web applications with more effective browser actions when compared to Selenium IDE
    2. We can handle multiple windows and pop-ups, we can use loops and conditions, capturing screenshot etc
    3. RC can perform Data-Driven (read/write data from external files) concept, decent report generation and mailing
    4. All of the above

    Ans: 4

  6. What are the languages and operating systems that support RC ?

    1. Java
    2. C#
    3. Perl
    4. Python
    5. All of the above

    Ans: 5

  7. Sleep() method is used ___
  8. To pause the test execution untill the time provided in sleep method
    1. To stop the test
    2. To set the time of delay which will follow each and every selenium command
    3. None of the above

    Ans: 1

  9. How do you select second value from a drop down menu ?

    1. String a[]=selenium.getSelectOptions(locator of drop down);
    2. selenium.select(""locator of drop down"", a[2]);
    3. selenium.select("locator of drop down", "value);
    4. "String a[]=selenium.getSelectOptions(locator of drop down);
    5. selenium.select(""locator of drop down"", a[1]);
    6. None of the above

    Ans: 3

  10. What are the frameworks available in RC ?

    1. JUnit
    2. NUnit
    3. TestNG
    4. Bromine
    5. All of the above

    Ans: 5

  11. How do you run selenium commands in slow motion in Selenium RC?

    1. Thread.Sleep
    2. Selenium.SetSpeed
    3. Wait()
    4. Both 1 & 2

    Ans: 4

JUnit

  1. What Is JUnit?

    1. It is a software testing framework to for unit testing.
    2. It is written in Java and designed to test Java applications.
    3. It is an Open Source Software
    4. All of the above

    Ans: 4

  2. How To Write a Simple JUnit Test Class?

    1. "import org.junit.*;
                      public class HelloTest
                      {
                      @Test public void testHello()
                      {
                      String message = ""Hello World!"";
                      Assert.assertEquals(12, message.length());
                      }
                       }"
    2. "@Test public void testHello()
                      {
                      String message = ""Hello World!"";
                      Assert.assertEquals(12, message.length());
                      }"
    3. "public class HelloTest
                      {
                      @Test public void testHello()
                      {
                      String message = ""Hello World!"";
                      Assert.assertEquals(12, message.length());
                      }"
    4. None of the above

    Ans: 1

  3. Why Not Just Use a Debugger for Unit Testing?

    1. Debugger is designed for automation unit testing
    2. Debugger is designed for manual debugging
    3. Debugger can be used for unit testing
    4. All of the above

    Ans: 2

  4. Do You Need to Write a Test Class for Every Class That Need to Be Tested?

    1. Yes
    2. No

    Ans: 2

  5. How to create a Test Suite using JUnit in Eclipse?

    1. Select File > New > Other… > Java > JUnit > JUnit Test Suite.
    2. Select the arrow of the button in the upper left of the toolbar. Select Other… > Java > JUnit > JUnit Test Suite,
    3. Right click on a package in the Package Explorer view in the Java Perspective, and select Other… > Java > JUnit > JUnit Test Suite,
    4. You can create a normal Java class, but include junit.framework.TestSuite as the super class of the test class you are creating.
    5. All of the above

    Ans:5

  6. How to Run a JUnit Test Case in Eclipse?

    1. You can right click on the test case class or test suite class and select Run As > JUnit Test.
    2. You can select a test case or suite and click the arrow on the icon or select Run from the toolbar, and select Run As > JUnit Test.
    3. Both 1 and 2
    4. None of the above

    Ans: 3

  7. ANT

    1. ANT is a ___

      1. Build Tool Only For Java.
      2. Build Tools Only For .Net
      3. A language
      4. Build Tool

      Ans: 4

    2. How to make build directory in XML file?

      1. None of the above

      Ans: 3

    3. Which one is the properties of the Ant?

      1. Basedir
      2. basedir
      3. rootdir
      4. None of the above

      Ans: 2

    4. Which one is not a properties of the Ant?

      1. ant.java.version
      2. ant.version
      3. ant.create
      4. ant.home

      Ans: 3

    5. Which one is true method for message printing in xml file?

      1. printf
      2. println
      3. echo
      4. None of the above

      Ans: 3

    6. We can execute the class file with help of Ant?

      1. TRUE
      2. FALSE

      Ans: 1

    7. What is Stand for is Ant VM?

      1. Account Virtual Machines
      2. Accountable Virtual Machines
      3. Amountable Virtual Machines
      4. All of the above

      Ans: 2

    8. How to set the Source directory in Ant?

      1. <Property name="dir.src" value="src"/>
      2. <property name="dir.build" value="biuld"/>
      3. <property name="dir.src" value="src"/>
      4. None of the above

      Ans: 3

    9. Ant Can make directory with relative path?

      1. TRUE
      2. FALSE

      Ans: 1

    10. Which one is the sign of path seperator in Ant?

      1. .
      2. ;
      3. ,
      4. :

      Ans: 3

    11. Can manual tester develop tests in Keyword Driven Framework?

      1. Yes
      2. No
      3. May be
      4. None of the above

      Ans:1

    12. Can you define different function libraries in Keyword Driven Framework?

      1. No
      2. Yes
      3. May be
      4. None of the above

      Ans: 2

    13. Each keyword related to a function defined in function library. Is this statement True?

      1. May be
      2. FALSE
      3. TRUE
      4. None of the above

      Ans: 3

    14. While Designing Keyword Driven Framework we can map keywords at ___

      1. Operation level
      2. Functional level
      3. Both Operation and functional level
      4. None of the above

      Ans: 3

    15. What are the common components of Keyword driven framework?

      1. Excel Sheet to Store the Keywords
      2. Function Library
      3. Test Control file
      4. Test Scripts
      5. All of the above

      Ans: 5

    16. What is Driver script in framework?

      1. Script is used to initialize and read the control files
      2. Consists details of all the Test scenarios to be automated.
      3. Driver Script reads the Test Case files. Checks the keywords and calls the appropriate utility script functions based on specific keyword
      4. None of the above

      Ans: 3

    Webdriver Overview

    1. Which of these WebDriver interface methods is used to open a URL in the browser?

      1. get
      2. navigate().to
      3. Any of the above
      4. None of the above

      Ans: 3

    2. What is the difference between WebDriver close and quit methods?

      1. Nothing, these methods are interchangeable.
      2. close method clears the browser memory and the quit method closes the browser window.
      3. close method closes the browser but the quit method additionally removes the connection to the server.
      4. close method closes the main browser window but the quit method closes all the browser windows including popups.

      Ans: 4

    3. When invoked on a web element, what does the submit method do?

      1. It is used to submit a form and it works on any web element.
      2. It is used to submit a form but it works only on the web element whose type is “submit”.
      3. It is the same as the click method.
      4. There is no submit method for a web element.

      Ans: 1

    4. Which WebDriver method is used to change focus to an alert, a web element or a browser window?

      1. changeFocus
      2. switchTo
      3. goTo
      4. setFocus

      Ans: 2

    5. What functionality does WebDriver support on browser cookies?

      1. add and delete an individual cookie
      2. delete all cookies
      3. Any of the above
      4. None of the above

      Ans: 3

    6. What is the scope of an implicit wait?

      1. All instances of WebDriver
      2. Current WebDriver instance
      3. Current expected condition
      4. Current web element

      Ans: 2

    7. What is Selenium Webdriver?

      1. It is an API
      2. A tool for writing automated tests of website
      3. Successor of Selenium RC
      4. All of the above

      Ans: 4

    8. Which browsers does Webdriver support?

      1. Chrome
      2. Internet Explorer
      3. Firefox Opera
      4. All of the above
      5. Ans: 5

      6. What are the advantages of webdriver?

        1. Unlike RC you don’t have to start a server in webdriver
        2. Tabs and pops are more or less the same. RC can also handle and Webdriver can also handle.
        3. Simulate key press events of keyboard.
        4. Better features for Ajax testing.
        5. All of the above

        Ans: 5

      7. How to create instance of firefox driver using webdriver?

        1. driver = new FirefoxDriver();
        2. driver = FirefoxDriver();
        3. driver = new Firefox;
        4. None of the above

        Ans: 1

      Keyword Driven Framework

      1. What are the external files which will be required to develop Keyword driven framwork?

        1. TestNG
        2. JXL/POI
        3. JUnit
        4. TestNG plugin for eclipse
        5. All of the above

        Ans: 5

      2. What is the purpose of TestNG component in Keyword driven framework?

        1. in order to data drive our test
        2. in order to read excel file
        3. requires to verify conditions
        4. None of the above

        Ans: 1

      3. JXL/POI jar files are required to _____.

        1. requires to verify conditions
        2. in order to use Microsoft Excel files as data source
        3. in order to data drive our test
        4. All of the above

        Ans: 2

      4. How to create an instance of WebDriver?

        1. WebDriver driver = FirefoxDriver();
        2. WebDriver = new FirefoxDriver();
        3. WebDriver driver = CreateObject FirefoxDriver();
        4. WebDriver driver = new FirefoxDriver();

        Ans: 4

      5. How to navigate to the ITeLearn home page?

        1. Webdriver.get("http://www.itelearn.com");
        2. driver.navigate("http://www.itelearn.com");
        3. driver.get("http://www.itelearn.com");
        4. None of the above

        Ans: 3

      6. How to find an element by Name?

        1. WebElement searchBox = driver.findElement(By.name("someElement"));
        2. WebElement searchBox = findElement(By.name("someElement"));
        3. WebElement searchBox = driver.findElement(name("someElement"));
        4. All of the above

        Ans: 1

      7. Display the title of the page ____.

        1. System.out.println("Title: " + driver.Title());
        2. System.out.println("Title: " + driver.getTitle());
        3. System.out.println("Title: " + getTitle());
        4. None of the above

        Ans: 2

      8. Does Selenium supports regular expression?

        1. Yes
        2. No

        Ans: 1

      9. _____ statement matches links such as ‘Over $75′, ‘Over $85′ etc

        1. selenium.click("link=^Over \\$[0-9]+$");
        2. selenium.click("link=regexpi:^Over \\$+$");
        3. selenium.click("link=regexpi:Over \\$[0-9]+$");
        4. selenium.click("link=regexpi:^Over \\$[0-9]+$");

        Ans: 4

      10. ____ statement clicks on the first image that has an id attribute that starts with ‘cat_prod_image’.

        1. selenium.click("//img[(@id,'cat_prod_image')]");
        2. selenium.click("[starts-with(@id,'cat_prod_image')]");
        3. selenium.click("//img[starts-with(@id,'cat_prod_image')]");

        None of the above

      Ans: 3

    Hybrid Framework using Webdriver

    1. “____ is the combination of both keyboard driven and data driven frameworks”

      1. Linear Framework
      2. Hybrid Framework
      3. Modular Framework
      4. Keyword Driven Framework

      Ans: 2

    2. In Which case we can design Hybrid Framework

      1. Rich Application functionality
      2. Data sensitive testing
      3. Regression testing
      4. All of the above

      Ans: 4

    3. What are the advantages of Hybrid framework?

      1. Flexible
      2. Increases accuracy
      3. Highest ROI
      4. All of the above

      Ans: 4

    4. In Hybrid framework, data can accessed through database, excel file, xml etc.

      1. TRUE
      2. FALSE

      Ans: 1

    5. Hybrid framework can be implemented for any application.

      1. TRUE
      2. FALSE

      Ans: 1

    6. What are the frameworks available other than DDF, KDF and Hybrid?

      1. Linear Framework
      2. Modular Framework
      3. Structured Framework
      4. All of the above

      Ans: 4

Selenium Database Testing

  1. What are the advantages of Database testing?

    1. Both functional and DB testing can be performed at the same time while running the automation script.
    2. Validate data displaying on a webpage and compare the same with database.
    3. Connect to SQL, MySQL servers etc.
    4. All of the above

    Ans: 4

  2. mysql coonection jar file is required to connect with database

    1. TRUE
    2. FALSE

    Ans: 1

  3. How to create instance of mysql to connect with database?

    1. Object myDC = Class.forName(com.mysql.jdbc.Driver);
    2. Object myDC = Class.forName(com.mysql.jdbc.Driver);
    3. Object myDC = Class.forName("com.mysql.jdbc.Driver").newInstance();
    4. None of the above

    Ans: 3

  4. How to create database connection?

    1. mycon = DriverManager.getConnection(myUName, myPWD)mySt=mycon.createStatement();
    2. mycon = DriverManager.getConnection(mySQLDB, myUName, myPWD
    3. mySt=mycon.createStatement();	mycon=getConnection(mySQLDB, myUName, myPWD)
    4. mySt=mycon.createStatement();
    5. None of the above

    Ans: 2

  5. How to pass any sql query after database connection?

    1. PreparedStatement preparedStatement = conn.prepareStatement("select * from YourTableName");
    2. preparedStatement = conn.prepareStatement("select * from YourTableName");
    3. PreparedStatement preparedStatement = prepareStatement("select * from YourTableName");
    4. All of the above

    Ans: 1

  6. What is Recordset in terms of Database?

    1. Recordset also works as a View in Database
    2. Recordset is a virtual table which stores data
    3. It is used to open database connection
    4. Recordset object is used to hold a set of records from a database table. A Recordset object consist of records and columns

    Ans: 4

  7. How to create record set?

    1. set rs=CreateObject(""ADODB.recordset"")rs.Open ""Select * from Customers"", oConnection
    2. PreparedStatement preparedStatement = conn.prepareStatement(""select * from YourTableName"");resultSet = preparedStatement.executeQuery();
    3. PreparedStatement preparedStatement = conn.prepareStatement(""select * from YourTableName""); preparedStatement.executeQuery();
    4. None of the above

    Ans: 2

  8. ___ statement will print the EmpID from the record set. Assume EmpID is Integer.

    1. System.out.print(resultset.getInt("EmpID");
    2. System.out.print(resultset.getString("EmpID")
    3. System.out.print(resultset.getInt("Name")
    4. All of the above

    Ans: 1

  9. How to go on next data in record set?

    1. resultset.First();
    2. resultset.Last();
    3. resultset.MoveNext();
    4. resultset.next();

    Ans: 4

  10. ___statement will close the database connection?

    1. mycon.close;
    2. mycon.close()
    3. mycon.close();
    4. None of the above

    Ans: 3

Selenium Grid

  1. What is Selenium Grid?

    1. Scale by distributing tests on several machines
    2. manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS.
    3. minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure for instance
    4. All of the above

    Ans: 4

  2. The selenium-server-standalone package includes the ____.

    1. Hub
    2. Webdriver
    3. legacy RC needed to run the grid
    4. All of the above

    Ans: 4

  3. What is Hub in Selenium Grid?

    1. The Hub is framework to run the Grid.
    2. The Hub is the central point that will receive all the test request and distribute them the the right nodes.
    3. Both 1 & 2
    4. None of the above

    Ans: 2

  4. How to start Selenium hub?

    1. java -jar selenium-server-standalone-2.32.0.jar -role node
    2. java -role hub
    3. java -jar selenium-server-standalone-2.32.0.jar -role hub
    4. None of the above

    Ans: 3

  5. How to start Selenium nodes?

    1. java -jar selenium-server-standalone-2.32.0.jar -role node -hub http://localhost:4444/grid/register
    2. java -jar selenium-server-standalone-2.32.0.jar -role hub
    3. java -jar selenium-server-standalone-2.32.0.jar -role node
    4. All of the above

    Ans: 1

  6. How to start remote control on port “5556” and register it to the local hub?

    1. Dport =5556 launch-remote-contro
    2. ant -Dport =5555 launch-remote-contro
    3. ant -Dport =5556 launch-remote-contro
    4. None of the above

    Ans: 3

TestNG

  1. What is TestNG?

    1. TestNG is a testing framework
    2. designed to simplify a broad range of testing needs, from unit testing to integration testing
    3. Both 1 & 2
    4. None of the above

    Ans: 3

  2. What are the annotations available in TestNG?

    1. @BeforeSuite
    2. @AfterSuite
    3. @BeforeTest
    4. @BeforeGroups
    5. All of the above

    Ans: 5

  3. TestNG can be invoked from ____

    1. Command line
    2. ant
    3. Eclipse
    4. IntelliJ's IDEA
    5. All of the above

    Ans: 5

  4. ____ statement will invoke TestNG from command line.

    1. java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...]
    2. ant -Dport =5556 launch-remote-contro
    3. java org.testng.TestNG
    4. None of the above

    Ans: 1

Maven

  1. What is Maven?

    1. software tool for project management
    2. build automation
    3. building and managing Java projects
    4. All of the above

    Ans: 1

  2. How to compile application sources using Maven?

    1. change to the directory where pom.xml is created by archetype:generate
    2. "execute the following command:mvn compile"
    3. Both 1 & 2
    4. None of the above

    Ans: 3

  3. What is an archetype?

    1. building and managing Java projects
    2. An archetype can be defined as an original pattern from which all other things of the same kind are made.
    3. Both 1 & 2
    4. None of the above

    Ans: 2

  4. What are the different dependency scopes have you used?

    1. compile
    2. provided
    3. test
    4. import
    5. All of the above

    Ans: 5

  5. How to prevent including JARs in WEB-INF/lib? I need a "compile only" scope!

    1. The scope should be used for this is:
    2. provided
    3. compile
    4. import
    5. test

    Ans: 1

  6. How to determine what version of a plugin being used?

    1. mvn=install help:describe
    2. mvn -Dplugin=help:describe
    3. Both 1 & 2
    4. mvn -Dplugin=install help:describe

    Ans: 4

  7. Is it possible to create my own directory structure?

    1. Yes
    2. No

    Ans: 1

  8. What is POM?

    1. Project Object Model
    2. xml file that contains information about project and configuration
    3. It contains default value for most projects.
    4. All of the above

    Ans: 4

  9. When you compile a Maven project, where do you find the class files?

    1. ${basedir}/target/classes
    2. ${basedir}/target
    3. $/target/classes
    4. None of the above

    Ans: 1

  10. What is the command to install JAR file in local repository?

    1. mvn jar
    2. mvn package
    3. mvn install
    4. None of the above

    Ans: 3

Dynamic Pages, Window Alerts, Pop-Ups

  1. Is Selenium able to handle dynamic AJAX elements?

    1. Yes
    2. No
    3. Cant Say

    Ans: 1

  2. How to use xpath for dynamic elements?

    1. Identify the pattern and modify xpath pattern
    2. Directly use the xpath?
    3. Both 1 and 2
    4. None of the above

    Ans: 1

  3. Selenium can handle Javascript alerts.

    1. TRUE
    2. FALSE

    Ans: 1

  4. Is Regular expression helps to identify dynamic elements?

    1. Yes
    2. No
    3. Not very compatible

    Ans: 3

  5. How to check if any check box is checked or not?

    1. driver.findElement(By.id(<>).Selected()
    2. driver.findElement(By.id(<>).isSelected()
    3. driver.findElement(By.id(<>).isChecked()
    4. All of the above

    Ans: 2

  6. Can Selenium handle Alerts or Pop ups windows?

    1. Yes
    2. No

    Ans: 1

  7. What is getWindowHandle method?

    1. Method will help to handle parent window
    2. Method will help to handle of opened windows other than parent
    3. Only handles alert
    4. None of the above

    Ans: 2

  8. How to handle alert using selenium?

    1. driver.switchto.popup()
    2. driver.switchto
    3. driver.switchto.alert()
    4. None of the above

    Ans: 3

  9. What is Iterator?

    1. Iterator enables you to cycle through a collection, obtaining or removing elements
    2. It basically starts at the beginning of a collection
    3. When you want to know which things are in a certain collection, you iterate over the collection, which is just another term for going through all elements. This is what an Iterator does
    4. All of the above

    Ans: 4

  10. After the popup actions, how to switch the driver back to the parent window?

    1. browser.switchTo().window(parentWindowHandle);
    2. browser.switchTo().alert();
    3. Both 1 & 2
    4. None of the above

    Ans: 1