thirtyfour
thirtyfour copied to clipboard
Cannot interact with WebElement
Webdriver can open Firefox and navigate to a web page, but it cannot send text and click a button on the web page. Can anyone help?
let driver = WebDriver::new("http://127.0.0.1:4444", caps).await?;
driver.goto("https://www.wikipedia.org").await?;
let elem_form = driver.find(By::Id("search-form")).await?;
// Find element from element.
let elem_text = elem_form.find(By::Id("searchInput")).await?;
// Type in the search terms.
elem_text.send_keys("selenium");
// Click the search button.
let elem_button = elem_form.find(By::Css("button[type='submit']")).await?;
elem_button.click();
My system info:
$ rustc --version
rustc 1.71.1 (eb26296b5 2023-08-03) (Red Hat 1.71.1-1.module_el8.9.0+3639+04ae6405)
Make sure your geckodriver is the correct version for your version of Firefox. The download page for geckodriver will tell you what version you need. You can check your Firefox browser version by going to the help menu and then "About"