I have a page with login and password (betmarathon[d.o.t]com).
I want to login to the site using selenium webdriver.
Selenium enters the login correctly, but i have problems with entering password.
I get "Element not visible" exception.
My code for selenium looks like this:
driver.findElement(By.id("auth_login")).sendKeys("MY-USERNAME");
driver.findElement(By.id("auth_login_password")).sendKeys("MY-PASSWORD");
Html code of the page looks like this:
<div class="user">
<input id="auth_login" class="empty" type="text" maxlength="40" rel="Login:" name="login" tabindex="1">
</div>
<div class="pass">
<input id="auth_login_password" type="password" regex="^.{6,}$" maxlength="100" rel="Password:" name="login_password" tabindex="2" style="display: none;">
<input class="undefined empty" type="text" value="Password:" tabindex="2" style="display: inline;">
</div>
You can see that there are 2 inputs for password, the first one is not visible and the second is visible. I should enter the password in the first input.
After I click on the box manually, the html code changes and the first input for password becomes visible (display:inline) and the second changes to display:none.
But how can I do it with selenium webdriver?
Thanks a lot in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…