Differences
  • Placement 360 CourseExplore
  • Software testing day 19

    Last Updated :
    Discuss
    Comments

    Question 1

    Which of the following is a benefit of using Relative Locators in Selenium?

    • A

      They increase test execution speed

    • B

      They allow locating elements based on their position relative to other elements

    • C

      They require complex XPath expressions

    • D

       They are only used for static web elements

    Question 2

    What is the key limitation of using Relative Locators in Selenium?

    • A

      They are not supported in Selenium 4

    • B

      They are slow and inefficient

    • C

      They are sensitive to window size and visibility of reference elements

    • D

      They only work with specific browsers

    Question 3

    In the Page Object Model (POM) design pattern, how are web elements typically handled?

    • A

      Web elements are directly handled in the test scripts

    • B

      Web elements are encapsulated in separate classes

    • C

      Web elements are stored in external files

    • D

      Web elements are initialized using annotations

    Question 4

    What method does Page Factory use to initialize web elements in Selenium?

    • A

      driver.findElement()

    • B

      PageFactory.initElements()

    • C

      WebDriverManager()

    • D

      @FindBy annotations

    Question 5

    Which of the following is a difference between Page Object Model (POM) and Page Factory?

    • A

      POM requires more boilerplate code for element initialization, while Page Factory reduces it

    • B

      POM uses annotations to define web elements, while Page Factory does not

    • C

      Page Factory requires manual element locator updates, while POM does not

    • D

      POM cannot be used for testing dynamic elements, while Page Factory can

    Question 6

    What is Shadow DOM used for in web development?

    • A

      To create invisible web elements

    • B

       To encapsulate styles and scripts within a component

    • C

      To improve browser performance

    • D

       To prevent browser pop-ups

    Question 7

    How can Shadow DOM elements be accessed in Selenium WebDriver?

    • A

      By using driver.findElement() directly on the shadow element

    • B

       By using getShadowRoot() or JavascriptExecutor

    • C

      By waiting for the shadow DOM to load

    • D

      By using the driver.switchTo().frame() method

    Question 8

    In the context of Selenium, what does JavascriptExecutor allow you to do?

    • A

      It allows Selenium to manage browser sessions

    • B

       It lets you execute JavaScript within the browser's context

    • C

      It handles synchronization issues in Selenium tests

    • D

       It enhances the performance of Selenium tests

    Question 9

    What does the following JavascriptExecutor command do?

     js.executeScript("window.scrollBy(0,150)");
    • A

      It opens a new browser window

    • B

      It scrolls the page by 150 pixels vertically

    • C

       It scrolls the page by 150 pixels horizontally

    • D

       It clicks an element on the page

    Question 10

    What is the main challenge when automating Shadow DOM elements in Selenium?

    • A

      Shadow DOM elements cannot be located using standard locators

    • B

      Shadow DOM elements are too slow to interact with

    • C

      Shadow DOM elements are only available in specific browsers

    • D

      Shadow DOM is deprecated and no longer supported

    There are 10 questions to complete.

    Take a part in the ongoing discussion