How to read value from Password Field in Selenium/Webdriver -


i have scenario in want read values excel , put username , password field, later want verify whether username , password got entered in proper comparing excel values.

below sample code given w.r.t "gmail". html code:

<input type="password" name="passwd" id="passwd"> 

webdriver code:

driver.driver.get("https://www.gmail.com"); driver.driver.findelement(by.name("passwd")).sendkeys("mahesh");     system.out.println(driver.pflogin.gettxtpassword().getattribute("value")); 

getting error above code, since password field dont have "value" attribute

kindly me on this..

thanks mahesh

try this,

system.out.println(driver.findelement(by.id("passwd")).getattribute("value")); 

make sure, typing input element, changing value attribute text.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -