10000 Using Drag and Drop through X,Y parameters in SB Format · Issue #3851 · seleniumbase/SeleniumBase · GitHub
[go: up one dir, main page]

Skip to content
Using Drag and Drop through X,Y parameters in SB Format #3851
Closed
@muffinweb

Description

@muffinweb

I want to drag and drop a div which you can scroll it to right direction on a horizontal bar however i guess reaching methods below is not possible in SeleniumBase SB format

SeleniumBase SB format

with SB(uc=True, test=True) as sb:
  sb.gui_hover_element("div.moving-div", 0.5)
  rect = sb.get_gui_element_rect("div.bar-of-moving-div")
  sb.gui_drag_drop_points(rect["x"] + 10, rect["y"], rect["x"] + 180, rect["y"])

Sample below works like a charm however i need to specify x, y to limit drop point instead of drop selector in SB Format

Sample

import time

from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    sb.activate_cdp_mode("https://www.w3schools.com/html/html5_draganddrop.asp")
    sb.wait_for_element_visible("#img1")
    sb.drag_and_drop("#img1", "#div2")
    time.sleep(2)

Is there any way to do it?

Thanks all you have done for community

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModequestionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0