5/12/17

Webdriver Questions & Answers

    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

2 comments:

  1. Thanks for sharing Post

    ReplyDelete
  2. Thanks for posting it.
    It is amazing sharing for us.

    ReplyDelete