I am wanting to select a specific option using a dynamic xpath to get the text out of a single option in a dropdown menu.
Currently I have tried setting up a variable and using it in the xpath like so:
//*[@id=“id_name”]/option[‘${j}’]
Where J is an int that I have defined to be equal to the index of my for loop + 1
Any suggestions on how to get this to work as currently its only getting the first option each time (option[1]) in which J is equal to 2 in the first iteration of the for loop.
Defined J in the script like so: int j = (i+1)