Trying to enter pin number in dynamic textfield. Pin number option get change each time once website loaded.
<input type="password" maxlength="1" class="input-pin input-validation-error" placeholder="3rd" id="txtPin_3" name="txtPin_3" required="" data-errormessage-value-missing="Please input PIN" data-errormessage-type-mismatch="Invalid!" autocomplete="off" style="width:50px;">
<input type="password" maxlength="1" class="input-pin" placeholder="2nd" id="txtPin_2" name="txtPin_2" required="" data-errormessage-value-missing="Please input PIN" data-errormessage-type-mismatch="Invalid!" autocomplete="off" style="width:50px;">
<input type="password" maxlength="1" class="input-pin" placeholder="1st" id="txtPin_1" name="txtPin_1" required="" data-errormessage-value-missing="Please input PIN" data-errormessage-type-mismatch="Invalid!" autocomplete="off" style="width:50px;">
<input type="password" maxlength="4" class="input-pin" placeholder="4th" id="txtPin_1" name="txtPin_4" required="" data-errormessage-value-missing="Please input PIN" data-errormessage-type-mismatch="Invalid!" autocomplete="off" style="width:50px;">
Update:
I tried below CSS selector and its not working.
WebElement Pin = driver.findElement(By.cssSelector("input[id*txtPin_1]"));
Pin.sendKeys("1");
WebElement Pin1 = driver.findElement(By.cssSelector("input[id*txtPin_2]"));
Pin1.sendKeys("2");
WebElement Pin2 = driver.findElement(By.cssSelector("input[id*txtPin_3]"));
Pin2.sendKeys("3");
WebElement Pin3 = driver.findElement(By.cssSelector("input[id*txtPin_4]"));
Pin3.sendKeys("4");
I need to enter only 3 pin numbers out of 4