I have to automate a scenario in Selenium in which I am required to pick values from an excel file and then to input that in the login fields of the webpage. There is a check to be placed in the first value to be picked, which I am unable to complete.
Suppose I am picking up values 103030, from the first row, first column. Now this is a six digit number. The webpage field where I am supposed to enter this checks for a minimum 9 digit number.
So, if it is a six, or a seven digit number, I have to concatenate leading zeros for the remaining places.
For example,in this scenario, 103030 is a 6 digit number, and it requires three more digits to become a 9 digit number. So I have to add three leading zeros to this- like 000103030. Similarly if it is a seven digit number- like 1030303, then I have to add 001030303.
How can this be achieved.
The way I thought it can be achieved is by finding the number of digits, subtracting that by 9 and then replacing the required number with zeroes, but I'm struggling with the logic for adding leading zeroes.