Skip to content Skip to sidebar Skip to footer

How To Enter Password Using Selenium Webdriver If The Password Style Is Display:none

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 e

Solution 1:

Click the second password input and then send keys to the first one:

driver.findElement(By.xpath("//div[@class='pass']/input[last()]")).click();
driver.findElement(By.id("auth_login_password")).sendKeys("MY-PASSWORD");

Solution 2:

Possible answer could be javascript as well. You can directly execute javascript on a hidden element and set the attribute.

WebDriver driver; 
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('auth_login_password').setAttribute('value', val );");

Solution 3:

driver.ExecuteScript(string.Format("document.getElementById('cred-password-inputtext').value='{0}';",password));

This solved the problem for me


Post a Comment for "How To Enter Password Using Selenium Webdriver If The Password Style Is Display:none"