C # Selenium - how to detect that authentication has been successful

1

How can I know when the authentication is successful after passing the username and password?

I would like to stop the execution and show once the connection was successful.

This is my code?

driver.Navigate().GoToUrl("MiURL");
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));   

List<string> matchingLinks = new List<string>();

IWebElement username = driver.FindElement(By.Name("test"));
userName.SendKeys(c);
IWebElement passwword = driver.FindElement(By.Name("test123"));
userPass.SendKeys(c);
userPass.Submit();
    
asked by A arancibia 09.06.2018 в 16:32
source

1 answer

0

You have to identify on the destination page, some element that indicates that the operation was successful.

Example: if there is a <div id="perfil_usuario">Algo</div> element in the login target screen, then search for it. If you find it, the login will have been successful. Otherwise, no.

    
answered by 09.06.2018 / 16:43
source