pub struct Alert<'a> { /* private fields */ }Expand description
Struct for managing alerts.
Implementations§
Source§impl<'a> Alert<'a>
impl<'a> Alert<'a>
Sourcepub fn new(session: &'a WebDriverSession) -> Self
pub fn new(session: &'a WebDriverSession) -> Self
Create a new Alert struct. This is typically created internally
via a call to WebDriver::switch_to().alert().
Sourcepub fn text(&self) -> WebDriverResult<String>
pub fn text(&self) -> WebDriverResult<String>
Get the active alert text.
§Example:
let alert = driver.switch_to().alert();
let text = alert.text()?;Sourcepub fn dismiss(&self) -> WebDriverResult<()>
pub fn dismiss(&self) -> WebDriverResult<()>
Sourcepub fn accept(&self) -> WebDriverResult<()>
pub fn accept(&self) -> WebDriverResult<()>
Sourcepub fn send_keys<S>(&self, keys: S) -> WebDriverResult<()>where
S: Into<TypingData>,
pub fn send_keys<S>(&self, keys: S) -> WebDriverResult<()>where
S: Into<TypingData>,
Send the specified keys to the active alert.
§Example:
You can specify anything that implements Into<TypingData>. This
includes &str and String.
let alert = driver.switch_to().alert();
alert.send_keys("selenium")?;
alert.accept()?;You can also send special key combinations like this:
let alert = driver.switch_to().alert();
alert.send_keys("selenium")?;
alert.send_keys(Keys::Control + "a")?;
alert.send_keys("thirtyfour")?;Auto Trait Implementations§
impl<'a> Freeze for Alert<'a>
impl<'a> RefUnwindSafe for Alert<'a>
impl<'a> Send for Alert<'a>
impl<'a> Sync for Alert<'a>
impl<'a> Unpin for Alert<'a>
impl<'a> UnwindSafe for Alert<'a>
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