Jacobvu84 / selenium-vietnam-training-course

Questions Tracking
7 stars 5 forks source link

Selenium WebDriver API - Test 10 questions - Part 01 #27

Open Jacobvu84 opened 6 years ago

Jacobvu84 commented 6 years ago

Kiểm tra kiến thức của học sinh về Selenium Web Webriver API

  1. Explain how you can login into any site if it’s showing any authentication popup for password and username?

    a. Syntax-http://username-password@url
    b. Syntax-http://username_password@url
    c. Syntax-http://username:password@url
    d. Syntax-http://username:password.url
  2. What is the difference b/w close() and quit()?

    
    close() – it will close the browser where the control is.
    quit()   – it will close all the browsers opened by WebDriver.

a. True b. False


03. FirefoxDriver is class or an interface and from where is it inherited ?

a. FirefoxDriver is a class. It implements all the methods of FirefoxActions interface. b. FirefoxDriver is a class. It implements all the methods of BrowserDriver interface. c. FirefoxDriver is a class. It implements all the methods of WebDriver interface. d. FirefoxDriver is a class. It implements all the methods of WebDriverFirefox interface.

04. After the following code fragment, what is the value in a?

WebElement link = element(getWebElement(linkText)); withAction().moveToElement(link) .contextClick(link) .sendKeys(Keys.ARROW_DOWN) .sendKeys(Keys.ARROW_DOWN)
.sendKeys(Keys.ENTER)
.perform();

a. Open link in a new tab b. Open link in a new private Window c. Open link in a new Window


05. In webdriver, which of the following commands retrieves the text of a html element?

a. selectText() b. getText() c. getElementText() d. getText(element)


06. In webdriver, selectAllOptions() is a valid command.

a. True b. False


07. What is the output of the following statement?
Name 1 Name 2

driver.findElement(By.cssSelector("#name"));

a. Output is Name 1 b. Output is Name 2 c. CSS selector syntax is incorrect

08. Consider the following code snippet

WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.presenceOfElementLocated(by));

This is an example of an implicit wait: a. True / b. False

09. Which WebDriver method is used to change focus to an alert, a frame or a browser window?

a. changeFocus() b. setFocus() c. switchTo() d. changeTo(

10. Implicit wait time is applied to all elements in your script and Explicit wait time is applied only for particular specified element.

a. True b. False


11. The following codes both print: Welcome to TestingExcellence.com
Welcome to TestingExcellence.com

System.out.println(driver.getTitle()); System.out.println(driver.findElement(By.tagName("title")).getText());

a. True b. False


12. In WebDriver, which command can be used to enter values onto text boxes? Select the best answer

a. type() b. selenium.type() c. driver.type() d. sendKeys() e. sendKeys("text")


13. Consider the following html snippet
Which CSS selector is a valid statement to select Opera?

a. css = li.contains("Opera") b. css = ul.li(4) c. css = ul > li:nth-of-type(4) d. css = ul > li:nth-of-type(3) e. css = ul.li:nth-child(4)


14. In webdriver, deselectAll() is a valid command

a. True b. False


15.  In webdriver, which command takes you forward by one page on the browser’s history?

a. navigate.forward() b. Navigate.forward() c. navigate().forward() d. Navigate.forward e. navigate_forward()


16. In webdriver, which of the following is a valid select statement that selects a value from a drop down element?

a. selectByIndex() b. selectByVisibleText() c. selectByValue() d. all above e. none of above


17. In webdriver, which methods navigates to a URL?

a. goToUrl("url") b. navigate.to("url") c. getUrl("url") d. get("url")


18. Consider the following HTML code snippet
1 2
3 4

driver.findElement(By.xpath("//table/tr[1]/td")).getText();

a. The above statement returns 1 b. The above statement returns 3 c. The xpath query is incorrect d. webdriver statement is incorrect


19. In webdriver, what is the method that counts the number of elements?

a. driver.getCountOfElements() b. driver.findElement(By.id("search")).getCount() c. driver.findElements(By.id("search")).size() d. driver.findElements(By.id("search")).length()


20.  In webdriver, which of the following is a valid to handle alerts/popups?

a. dismiss() b. accept() c. getText() d. sendKeys(String stringToSend) e. All of above f. None of above

giangnd2508 commented 6 years ago

Đây là đáp án của em. :D lâu ko làm chắc sai hết 10-12-2017 2-27-26 pm

Jacobvu84 commented 6 years ago

@giangnd2508 : Kết quả của em là 15/20, Các câu sai là 5.7.13.18.19

wizardsconan commented 6 years ago

Đáp án của em: 1A; 2A; 3C; 4A; 5B; 6B; 7A; 8A; 9C; 10A; 11A; 12 E; 13C; 14A; 15A; 16D; 17D; 18A; 19C; 20E

Jacobvu84 commented 6 years ago

@wizardsconan Kết quả của em là 16/20 Các câu sai là 1.4.8.15