Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drag Iframe Element in CDP Mode #3302

Answered by mdmintz
harrier999 asked this question in Q&A
Discussion options

Is it possible to drag iframe element in CDP mode?
get_nested_element retrives element in iframe. But it seems mouse_drag method does not work with the element

Or is there relative drag method for element in CDP mode?

You must be logged in to vote

To drag and drop an element in CDP Mode:

sb.cdp.gui_drag_and_drop(drag_selector, drop_selector)

Example in examples/cdp_mode/raw_demo_site.py

Replies: 1 comment 2 replies

Comment options

To drag and drop an element in CDP Mode:

sb.cdp.gui_drag_and_drop(drag_selector, drop_selector)

Example in examples/cdp_mode/raw_demo_site.py

You must be logged in to vote
2 replies
Comment options

  1. There are no examples of drag and drop inside an iframe there.

  2. This does not work

handle = sb.cdp.get_nested_element(iframe, hadle_selector)
position = handle.get_position()
x1, y1 = position.x, position.y
x2, y2 = x1 + 50, y1,
sb.cdp.gui_drag_drop_points(x1, y1, x2, y2)
  1. What if the element doesn't exist in the destination?
    How do I move the starting point by x and y pixels relative to the destination?
Comment options

You'll have to use sb.cdp.gui_drag_drop_points(x1, y1, x2, y2) and determine the coordinates yourself.

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /