StefanS
StefanS

Reputation: 229

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.

Upvotes: 1

Views: 1347

Answers (2)

Ali Azam
Ali Azam

Reputation: 2115

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("[email protected]");

    elem.FindElement(By.Id("inputPassword")).Clear();
    elem.FindElement(By.Id("inputPassword")).SendKeys("[email protected]");

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

Upvotes: 2

Richard
Richard

Reputation: 9019

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.

Upvotes: 1

Related Questions