<form name="loginForm" ng-submit="login()" autocomplete="off" class="ng-pristine ng-invalid ng-invalid-required">
<button type="submit" class="icon-login" ng-disabled="!loginForm.$valid" disabled="enabled"></button>
<input type="text" name="username" id="username" placeholder="Username / Email" autocapitalize="off" autocorrect="off" required="" ng-model="credentials.username" class="ng-pristine ng-invalid ng-invalid-required">
<input type="password" name="password" id="password" placeholder="Password" autocapitalize="off" autocorrect="off" required="" ng-model="credentials.password" class="ng-pristine ng-invalid ng-invalid-required">
</form>
I tried:
IWebElement button = driver.FindElement(By.ClassName("icon-login"));
But that didn't work and when I took a screenshot it appears that the button is just not visible while it should be...
I tried using a wait until too but that just times out even with a minute on it
edit:
IWebElement element = new WebDriverWait(driver, TimeSpan.FromSeconds(3)).Until(ExpectedConditions.ElementExists(By.XPath("//form[@name='loginForm']/button[@class='icon-login']")));
Tried that but it justs times out, the element does exsist but not clickable
As per your comment update along with the url it seems the Username , Password field and the Login button all are within a form. So once you fill up the Username , Password fields you can straightway invoke the Submit()
method to login into the website as follows :
new WebDriverWait(driver, TimeSpan.FromSeconds(3)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id='username' and @name='username']"))).SendKeys("refactorcoding");
driver.FindElement(By.XPath("//input[@id='password' and @name='password']")).SendKeys("refactorcoding");
driver.FindElement(By.XPath("//input[@id='password' and @name='password']")).Submit();
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.