Selenium Multiple Choice Questions Part - 2

1.Refer Below Code
public class Demo
{
  @Test(dataProvider = "dp")
  public void DemoTest(String n, String s)
  {
  }
  @DataProvider
  public Object[][] dp()
  {
   Object data[][]=new Object[4][3];
   return data;
  }
}
What is Problem with DemoTest Method


a.Number of  parameters should be 7 to DemoTest method
b.Number of  parameters should 4 to DemoTest method
c.Number of  parameters should be 3 to DemoTest method
d.it has no problem

2.What is the javascript method used to scroll to particular Element?
a.((JavascriptExecutor) driver).executeScript( element);
b.((JavascriptExecutor) driver).executeScript(“arguments[0].scrollIntoView();”, element);
c.((JavascriptExecutor) driver).executeScript(“arguments.scrollIntoView(true);”, element);   
d.((JavascriptExecutor) driver).executeScript(“arguments[0].scrollTo(true);”, element);

3.In following code which exception will occur
public class Demo
{
  WebDriver driver;
  @Test
  public void f1()
  {
   System.setProperty("webdriver.chrome.driver", "path of chromedriver");
   WebDriver driver=new ChromeDriver();
   driver.get("http://www.google.com");
  }
}

a.NullPointerException   
b.FileNotFoundException
c.MalformedURLException   
d.No Exception

4.What is the purpose of WebDriverBackedSelenium class in WebDriver application?
a.It's a WebDriver class implementing the Selenium-RC APIs.
b.It's a generic implementation of WebDriver to support multiple browsers.
c.It's a Selenium class to call WebDriver APIs.
d.None of these

5.Which class is for double click on element or use any key from keyboard using webdriver
a.Select class
b.KeyBoard Class
c.KeyBoards Class
d.Actions class

6.Cron pattern for running script at 20:15 (08:15 PM) every Saturday
a.15 08 * * 6
b.15 20 * * 5   
c.20 15 * * 5   
d.15 20 * * 6

7.How to switch to frame in webdriver   
a.driver.switchTo().frame(index of frame)
b.driver.switchTo().frame(name or id of frame)   
c.driver.switchTo().frame(WebElement)   
d.all of the options

8.What is the return Type of driver.getTitle() method in Selenium WebDriver.3   
a.Character   
b.String
c.void   
d.null

9.Select the Locator which is not available in Selenium WebDriver   
a.id
b.type
c.name
d.tagname

10.Which of the following is a correct difference b/w getWindowHandles() and getWindowHandle()?
a. getWindowHandles() returns address of all the open browsers whereas getWindowHandle() gets the address of the current browser.
b. getWindowHandles() returns a String whereas getWindowHandle() returns an Iterator<String>
c. getWindowHandles() returns the active browser handle whereas getWindowHandle() gives the top most browser handle
d. None of these.

11.Which of the following statement describes the most appropriate way to delete the cookies?
a.We can delete cookies in 3 ways.
 driver.manage().deleteCookieNamed("CookieName"); 
 driver.manage().deleteCookie(CookieId);
 driver.manage().deleteAllCookies();
b.We can delete cookies in 2 ways.
driver.manage().deleteCookieNamed("CookieName");
driver.manage().deleteCookie(CookieId);
c. driver.manage().deleteCookie(CookieId);
d. driver.manage().deleteCookieNamed("CookieName");

12.What does the below lines of code meant for?
WebDriver driver = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, "http://www.techbeamers.com/");

a. Will simply start the browser and open the site.
b. Will run webdriver tests using selenium.  
c. Will run Selenium 1.0 tests in webdriver.
d. None of these

13.Why is the actions class used for in WebDriver?
a. It controls the actions of web elements.
b. None of these.
c. It controls the actions of mouse.
d. It controls the actions of run-time exceptions

14.What does the below Selenium WebDriver code would subject to do?
Alert alert = driver.switchTo().alert();

a. This will close all of the currently open alert popups.
b. This will close the currently open alert popup.
c. This will return the currently open alert popup.
d. This will create a new alert popup.

15.Which of the following is the default status of JavaScript in HTMLUnitDriver?
a. Enabled
b. None of these
c. Disabled

16.Which of the following is the recommended way to handle dynamic elements?
a. All of these.
b. By using CSS locators.
c. By using regular expressions.
d. By using relative xpath locators 

17.What is the purpose of WebDriverBackedSelenium class in WebDriver application?
a. It's a Selenium class to call WebDriver APIs.
b. It's a generic implementation of WebDriver to support multiple browsers.
c. It's a WebDriver class implementing the Selenium-RC APIs.
d. None of these.

18.Why is the contextClick() used for?
a. It is used to right click.
b. It is used to click the hidden element.
c. It is used to open popup menu.
d. It is used to left click.

19.Is it possible to enable JavaScript in HTMLUnitDriver during driver initialization? If yes, then how?
a. Yes
WebDriver driver = new HtmlUnitDriver(true);
b. Yes
HtmlUnitDriver driver = new HtmlUnitDriver(true);
c. Yes   
WebDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true);
d. No

20.Which of the following is a correct difference b/w getWindowHandles() and getWindowHandle()?    
a.getWindowHandles() returns the active browser handle whereas getWindowHandle() gives the top most browser handle    
b.getWindowHandles() returns a String whereas getWindowHandle() returns an Iterator<String>    
c.getWindowHandles() returns address of all the open browsers whereas getWindowHandle() gets the address of the current browser   
d.None of these

21.Which Selenium command(s) simulates selecting a link?
a. findElement(By.Link("LinkName"))
b. findElement(By.Id("LinkName"))
c. findElement(By.linkText("LinkName"))
d. findElement(By.xpath("LinkName"))
e. findElement(By.tagName("LinkName"))

22.Which is not a TestNG Annotation
a.AfterClass
b.After
c.AfterMethod
d.BeforeSuite

23.Default Port Number of Hub in Grid is
a.8080
b.4444
c.5555
d.None of Above

24.System.setProperty(“_____________”,”Location of Driver”) for Internet Explorer Browser
a.WebDriver.IE.Driver
b.webdriver.ie.driver
c.webdriver.internetexplorer.driver
d.none of above

25.What does the below Selenium WebDriver code would subject to do? 
a.driver.switchTo().alert().dismiss();   
b.This will close all of the currently open alert popups   
c.This will close the currently open alert popup.     
d.This will return the currently open alert popup.    
e.This will create a new alert popup.


For Answers Click Here

Comments

  1. This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks Get for more information bachelor degree in pharmacy

    ReplyDelete

Post a Comment