<input id="password" name="password" maxlength="500" size="18" autocomplete="off" type="password">
<input id="passcode" name="password" maxlength="6" size="18" autocomplete="off" type="text">
I want to find if password textfield exist then enter "myPassword" otherwise if passcode textfield exist then enter "myPassCode" else throw exception.
if input id "password" exist then enter "mytext" otherwise
else if input id "passcode" exist then enter "myPassCode"
else throw exception (missing password,passcode text fields)
Must be a better way to do it then this???? (bad code) :(
try
{
driver.FindElement(By.Id("password")).SendKeys("myPassword");
}
catch (Exception ex)
{
try
{
driver.FindElement(By.Id("passcode")).SendKeys("myPassCode");
}
catch (Exception ex)
{
}
}