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

examples "wiki-tokio" can't click correctly "input#searchInput" #43

Closed
thouger opened this issue Mar 29, 2021 · 4 comments
Closed

examples "wiki-tokio" can't click correctly "input#searchInput" #43

thouger opened this issue Mar 29, 2021 · 4 comments

Comments

@thouger
Copy link

thouger commented Mar 29, 2021

i try to run cargo run --example wiki-tokio --features="tokio-runtime",it would be click input#searchInput and input text about "Rust programming language".But it actually click the element that is #ca-history,so the exmaples "wiki-tokio" finally will open https://en.wikipedia.org/w/index.php?title=Main_Page&action=history.I've been thinking for a long time, but I don't know why.My chrome version is Version 89.0.4389.90 (Official Build) (64-bit)

@mattsse
Copy link
Owner

mattsse commented Mar 29, 2021

Hmm, couldn't reproduce this with Chromium 88.0.4320.0 : https://streamable.com/a4x350.
I'm not sure what changed with 89.0.4389.90

@thouger
Copy link
Author

thouger commented Mar 29, 2021

I want to further find out the reasons, would you mind telling me how to communicate with chrome?Why didn't you original choosed webriver?

i'm came from voyager,you ready good at Rust and i have been learning from you recently. Thank you very much for your contribution,i just new at Rust.

@mattsse
Copy link
Owner

mattsse commented Mar 29, 2021

The webdriver API is different from chrome's native devtools protocol which is unique for chromium based browsers. You can read about how it works in detail, however the gist of it is, if you run chromium with the --remote-debugging-port=0 argument, it will expose a websocket port that listens for commands, such as Page.PrintTPDF, executes them and returns a response. To describe these commands, chromium uses a special format, like for browser protocol, this allows us to parse them and generate all the rust types via a build script. The API of chromiumoxide basically just bundles a set of commands to convenient operations.
If you want to know more, about the devtools protocol, you should look up puppeteer, the most sophisticated devtools api written in node, there should be a lot of tutorials about how it works in detail.

@thouger
Copy link
Author

thouger commented Apr 1, 2021

thanks mattsse!your erudition is amazing, I will go into deeper research here, if there is any new discovery, I will reopen issues,

@thouger thouger closed this as completed Apr 1, 2021
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