Actions Class & Advanced User Interactions

  1. Which Selenium class is used to perform complex user interactions like drag-and-drop and keyboard actions?
    A. WebDriverWait
    B. Select
    C. Actions
    D. ActionChains
    Answer: D. ActionChains

  2. To use ActionChains in Python, which import statement is correct?
    A. from selenium.webdriver.common.by import ActionChains
    B. from selenium.webdriver.support.ui import ActionChains
    C. from selenium.webdriver.common.action_chains import ActionChains
    D. from selenium.webdriver.common.actions import ActionChains
    Answer: C

  3. Which method of ActionChains performs the built-up actions?
    A. perform()
    B. execute()
    C. run()
    D. start()
    Answer: A

  4. What does the move_to_element() method do?
    A. Moves mouse cursor to the center of an element
    B. Clicks the element
    C. Scrolls to an element
    D. Types text into element
    Answer: A

  5. Which method is used for right-click?
    A. click()
    B. context_click()
    C. right_click()
    D. secondary_click()
    Answer: B

  6. Which method performs a double-click action?
    A. double_click()
    B. click_twice()
    C. duel_click()
    D. action_double()
    Answer: A

  7. Which method is used for drag-and-drop?
    A. drag_and_release()
    B. drag()
    C. drag_and_drop(source, target)
    D. drag_to(source, target)
    Answer: C

  8. Which methods simulate keyboard press and release?
    A. send_keys()
    B. key_press()
    C. key_down() and key_up()
    D. key_stroke()
    Answer: C

  9. What does click_and_hold() do?
    A. Double-clicks
    B. Holds down the left mouse button
    C. Takes a screenshot
    D. Right-clicks
    Answer: B

  10. Which Python class handles keyboard actions?
    A. selenium.webdriver.common.keys
    B. selenium.webdriver.common.keyboard
    C. selenium.webdriver.keys
    D. selenium.webdriver.driver.keys
    Answer: A

  11. Which method scrolls to an element using Actions API?
    A. scroll()
    B. scroll_to_element()
    C. move_to_element()
    D. scroll_to()
    Answer: B

  12. What does pause(2) do?
    A. Stops browser
    B. Pauses action chain for 2 seconds
    C. Refreshes after 2 seconds
    D. Closes browser
    Answer: B

  13. Which ActionChains method releases a held mouse button?
    A. mouse_release()
    B. release()
    C. up()
    D. drop()
    Answer: B

  14. Correct drag-and-drop sequence?
    A. click(), release(), perform()
    B. click_and_hold(), move_to_element(), release(), perform()
    C. move_to_element(), click(), perform()
    D. context_click(), release(), perform()
    Answer: B

  15. Which key emulates pressing Enter?
    A. Keys.RETURN
    B. Keys.ENTER
    C. Both A and B
    D. Keys.SUBMIT
    Answer: C

  16. If perform() is not used after actions, what happens?
    A. Error occurs
    B. Actions execute automatically
    C. Nothing happens
    D. Browser quits
    Answer: C

  17. Which method moves the mouse by x,y coordinates?
    A. move_to()
    B. move_to_offset()
    C. move_by_offset()
    D. move_mouse()
    Answer: C

  18. Which method sends keys to the active element?
    A. send_keys()
    B. write()
    C. input_keys()
    D. type()
    Answer: A

  19. Which method is used to click multiple elements one by one?
    A. multiple_click()
    B. click_and_hold()
    C. click() chained with perform()
    D. build()
    Answer: C

  20. What does build() do in ActionChains?
    A. Compiles actions without executing
    B. Executes actions
    C. Stops actions
    D. Clears action queue
    Answer: A

No comments:

Post a Comment