#[non_exhaustive]pub struct DropOptions {
pub files: Vec<FilePayload>,
pub data: Vec<(String, String)>,
pub position: Option<Position>,
pub timeout: Option<f64>,
}Expand description
Options for Locator::drop().
Simulates an external drag-and-drop of files and/or data onto an element
(e.g. an upload drop zone), dispatching dragenter/dragover/drop with a
synthetic DataTransfer. This is distinct from
Locator::drag_to(), which drags one
element onto another within the page.
Set files and/or data (the driver requires at least one).
§Example
use playwright_rs::{DropOptions, FilePayload, Position};
// Drop an in-memory file onto a drop zone
let file = FilePayload::new("note.txt", "text/plain", b"hello".to_vec());
let options = DropOptions::builder().file(file).build();
// Drop MIME-typed data (e.g. a dragged URL) at a specific point
let options = DropOptions::builder()
.data("text/uri-list", "https://example.com")
.position(Position { x: 10.0, y: 10.0 })
.build();See: https://playwright.dev/docs/api/class-locator#locator-drop
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.files: Vec<FilePayload>In-memory files to drop (serialized to the protocol’s payloads).
data: Vec<(String, String)>MIME-typed data entries to drop, as (mime_type, value) pairs.
position: Option<Position>Point within the element to drop at (relative to its top-left corner).
timeout: Option<f64>Maximum time in milliseconds.
Implementations§
Source§impl DropOptions
impl DropOptions
Sourcepub fn builder() -> DropOptionsBuilder
pub fn builder() -> DropOptionsBuilder
Create a new builder for DropOptions
Trait Implementations§
Source§impl Clone for DropOptions
impl Clone for DropOptions
Source§fn clone(&self) -> DropOptions
fn clone(&self) -> DropOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DropOptions
impl Debug for DropOptions
Source§impl Default for DropOptions
impl Default for DropOptions
Source§fn default() -> DropOptions
fn default() -> DropOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DropOptions
impl RefUnwindSafe for DropOptions
impl Send for DropOptions
impl Sync for DropOptions
impl Unpin for DropOptions
impl UnsafeUnpin for DropOptions
impl UnwindSafe for DropOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more