Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send_keys issue #265

Open
msdevega opened this issue Dec 22, 2024 · 2 comments
Open

Send_keys issue #265

msdevega opened this issue Dec 22, 2024 · 2 comments

Comments

@msdevega
Copy link

I use this code to fill a login box in a web page:
use std::error::Error;
use thirtyfour::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// define the browser options
let mut caps = DesiredCapabilities::chrome();
// to run Chrome in headless mode
// caps.add_arg("--headless=new")?; // comment out in development
caps.add_arg("--enable-automation")?; // comment out in development
// initialize a driver to control a Chrome instance
// with the specified options
let driver = WebDriver::new("http://localhost:9515", caps).await?;

// visit the target page
driver.goto("https://programme.openhouse.org.uk/login").await?;

//
let login = driver.find(By::Css("input#email-input")).await?;
login.send_keys("kevin.smith@gmail.com").await?;
println!("login");

// close the browser and release its resources
// driver.quit().await?;
Ok(())
}

The code execute without any error, but the login name is written incomplete in the web page:
vin.mith@gmail.com
and not
kevin.smith@gmail.com
as expected.
Any idea of how to solve this issue.
I use:
ChromeDriver 131.0.6778.108 (3b014839fbc4fb688b2f5af512d6ce312ad208b1-refs/branch-heads/6778@{#2393})
Google Chrome 131.0.6778.139
cargo 1.83.0 (5ffbef321 2024-10-29)
thirtyfour v0.35.0

Best regards

@9teta
Copy link

9teta commented Jan 1, 2025

I'm not a dev, but maybe try adding some wait before and after sending keys:

tokio::time::sleep(Duration::from_millis(20)).await;
// some io code
tokio::time::sleep(Duration::from_millis(20)).await;

@msdevega
Copy link
Author

msdevega commented Jan 2, 2025

I tried adding the sleeps before and after send_keys with the same result, the login name is incomplete in the web page.
Captura de pantalla 2025-01-02 a las 10 24 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants