简体   繁体   中英

Autofill email and password with Selenium Chrome C#

today the login page was changed https://fastinvest.com/de/investor/login and I am not able to fill in the email adress and password with selenium and chrome webdriver.

I usually use XPath, but the form fields will not be filled out. I also tried to execute a javascript but I couldn't make it.

It would be very nice if you could hlep me out how to set the email adress and password.

There are two controls on that page that are located with a selector like input#inputEmail . It is very likely your selector is finding the first instance of the input control, which is not displayed on the page.

This CSS selector should work for you: input#inputEmail.login__input .

It would be better to identify if you'd add some sample code with this question. How ever, your new code for login might be like -

IWebElement elem = driver.FindElement(By.Id("login-form"));

    elem.FindElement(By.Id("inputEmail")).Clear();
    elem.FindElement(By.Id("inputEmail")).SendKeys("test@gmail.com");

    elem.FindElement(By.Id("inputPassword")).Clear();
    elem.FindElement(By.Id("inputPassword")).SendKeys("test@gmail.com");

    elem.FindElement(By.CssSelector("button[type='submit']")).Click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM