samedi 2 janvier 2021

Import and insert word in sequence in Python

I want to import and insert word in sequence and NOT RANDOMLY, each registration attempt uses a single username and stop until the registration is completed. Then logout and begin a new registration with the next username in the list if the REGISTRATION is FAILED, and skip if the REGISTRATION is SUCCEDED.

I'm really confused because I have no clue. I've tried this code but it chooses randomly and I have no idea how to use the "for loop"

import random

Copy = driver.find_element_by_xpath('XPATH')
Copy.click()
names = [
   "Noah" ,"Liam" ,"William" ,"Anthony" 
]
idx = random.randint(0, len(names) - 1)
print(f"Picked name: {names[idx]}")
Copy.send_keys(names[idx])

How can I make it choose the next word in sequence and NOT RANDOMLY Any Help Please




Aucun commentaire:

Enregistrer un commentaire