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

find_element and CSS selector #93

Open
yassinevic opened this issue Aug 5, 2022 · 1 comment
Open

find_element and CSS selector #93

yassinevic opened this issue Aug 5, 2022 · 1 comment

Comments

@yassinevic
Copy link

Hello

I just start playing with this tool.
But i can't get any selector to work beside [name='j_username']

th code bellow will faile with error "-32000: DOM Error while querying"
same thing for [id='j_username']

did i miss somthing?

let page = browser.new_page("https://www.google.com/").await?; std::thread::sleep(std::time::Duration::from_secs(3)); page.find_element("a[href=https://policies.google.com/privacy?hl=en-MA&fg=1]").await? .click() .await?;

Tnx

@escritorio-gustavo
Copy link
Contributor

Try wrapping the attribute value in double quotes

let page = browser.new_page("https://www.google.com/").await?;
std::thread::sleep(std::time::Duration::from_secs(3));
page
    .find_element(r#"a[href="https://policies.google.com/privacy?hl=en-MA&fg=1"]"#)
    .await?
    .click()
    .await?;

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