selenium - Can't enter values into second element if two web elements are of same type -


how distinguish between elements of same type, in case, 2 password type elements while using selenium webdriver. in application, not able find elements name or id. used driver.switchto().activeelement().

now, there 2 elements of password types in html , when try access second element, value sent using element2.sendkeys("007") gets entered in element1 field.

in other words, can't access second element @ all!

try below code

list<webelement> element = driver.findelements(by.name('userid')); element.getindex("1").sendkeys("007"); list<webelement> element = driver.findelements(by.name('password')); element.getindex("1").sendkeys("007"); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -