ActionClass

  • perform() is an important function that enables all the actions by the mouse and keyboard to be implemented is performed
    • mouse and keyboard actions start wroking if perfort() is called
  • ActionChains automate low-level mouse and keyboard interactions in a test case

Mouse

Click, drag & drop, Move

Click

  • click(), click_and_hold(), context_click() ← right click, double_click()
  • If not argument “web_element” is given, then mouse will click on the current position
  • move_to_element() = focused on drop-down menus, where you can scroll or click after moving the mouse over it
  • move_by_offset(xoffset, yoffset) or move_to_element_with_offset(element, 200, 50)

Drag

  • drag_and_drop(element1,element2)
    • element1 = driver.find_element_by_id("drag")
    • element2 = driver.find_element_by_id("drop")
    • image
  • drag_and_drop_by(source, x_offset, y_offset)
  • #Locate circle1 element
    circle1 = driver.find_element_by_id("drag")
    #Locate circle2 element
    circle2 = driver.find_element_by_id("drop")
    #Getting offset values
    x_off = circle2.location.get("x")
    y_off = circle2.location.get("y")
    
    webdriver.ActionChains(driver).drag_and_drop_by_offset(circle1, x_off, y_off).perform()

Action - when we don’t perform an action it returns action class, but when using perform()

SuperMade with Super