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

Does it support Chinese? #216

Open
SnailFighter opened this issue Apr 17, 2024 · 6 comments
Open

Does it support Chinese? #216

SnailFighter opened this issue Apr 17, 2024 · 6 comments

Comments

@SnailFighter
Copy link

I try to type_str(Chinese words), but it fails, now doesn't it support Chinese?
let search_list_page = search_element.type_str("你好").await?.press_key("Enter").await?;

and
Finished dev [unoptimized + debuginfo] target(s) in 0.17s Running E:\rust\chromium\ticket_robber\target\debug\ticket_robber.exe11111111111111111111111the input-search element Element { remote_object_id: RemoteObjectId("1726069268081028633.3.3"), backend_node_id: BackendNodeId(14), node_id: NodeId(53), tab: PageInner { target_id: TargetId("62E07B0F3A85FD64F6912AEEB60FFA8A"), session_id: SessionId("1D060927DF75427396A695CC3468E1FA"), sender: Sender { closed: false } } } Error: ChromeMessage("Key not found: 你") error: process didn't exit successfully:E:\rust\chromium\ticket_robber\target\debug\ticket_robber.exe (exit code: 1)

@TinusgragLin
Copy link

TinusgragLin commented Apr 17, 2024

type_str(str) send a series of dispatchKeyEvent command messages to chromium via Chrome DevTools Protocol (on which this project is based) to emulate a series of keyboard input events. Since there is no “你” key in the standard keyboard, this error is expected.

@TinusgragLin
Copy link

TinusgragLin commented Apr 17, 2024

If you are looking for a crate for browser automation, thirtyfour is a popular option.

@SnailFighter
Copy link
Author

If you are looking for a crate for browser automation, thirtyfour is a popular option.

Ok, thanks for your advice, let me try the crate.

@TinusgragLin
Copy link

Note that if the experimental Input.insertText command is stabilized and implemented, this unfortunate limitation will be lifted.

@SnailFighter
Copy link
Author

If you are looking for a crate for browser automation, thirtyfour is a popular option.

get, if so, just only can input english, at present.

@openmynet
Copy link

openmynet commented Sep 27, 2024

///  input(page, &element, "你好")
pub async fn input_text(page: &Page, element: &Element, text: &str) -> Result<()> {
    element.click().await?;
    let cmd = chromiumoxide::cdp::browser_protocol::input::InsertTextParams::new(text);
    page.execute(cmd).await?;
    Ok(())
}

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

3 participants