vendredi 4 décembre 2020

From random to XPath

I have 3 random generated numbers with random function

random = random.sample(range(1, 10), 3)
print (random)

Result is: [1, 6, 8]

and have XPath where need to change result for each number from result

For 1st number:
'//*[@id="app"]/div/div[3]/div/div[1]/div[1]/div'

For 2nd number:
'//*[@id="app"]/div/div[3]/div/div[1]/div[6]/div'

For 3rd number:
'//*[@id="app"]/div/div[3]/div/div[1]/div[8]/div'

Tried with for loop but not working

for i in random:
    '//*[@id="app"]/div/div[3]/div/div[1]/div['+ i[0] +']/div'



Aucun commentaire:

Enregistrer un commentaire