Deal with iframe, not working
Mon-ius opened this issue · 1 comments
Mon-ius commented
do we have driver.switch_to.frame
as selenium
in Python does?
I tried it, but seems not working
use thirtyfour::prelude::*;
#[tokio::main]
async fn main() -> WebDriverResult<()> {
let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:9515", caps).await?;
driver.goto("https://xxx.com.cn").await?;
let frame = driver.find(By::Tag("iframe")).await?;
let elem_code = frame.find(By::Id("QR~QID65~6")).await?;
elem_code.send_keys("123333").await?;
driver.quit().await?;
Ok(())
}
Mon-ius commented
OK, it now works.
use thirtyfour::prelude::*;
#[tokio::main]
async fn main() -> WebDriverResult<()> {
let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:9515", caps).await?;
driver.goto("https://xxx.com.cn").await?;
driver.enter_frame(0).await?;
//let frame = driver.find(By::Tag("iframe")).await?;
let elem_code = driver.find(By::Id("QR~QID65~6")).await?;
elem_code.send_keys("123333").await?;
driver.quit().await?;
Ok(())
}