I'm writing a script in Python using Selenium and I'm trying to use Random Library and saving the generated data to a .txt file.
To get a better concept, here is a small example of what I'm trying to build.
import selenium
SavedText = "Saved."
Location = input("Please enter your Location:")
print(SavedText)
Password = input("Please enter your Password:")
print(SavedText)
driver.find_element_by_xpath("/html[1]/body[1]/main[1]/div[1]/div[2]/form[1]/div[7]/input[1]").send_keys(Password)
time.sleep(1)
driver.find_element_by_xpath("/html[1]/body[1]/main[1]/div[1]/div[2]/form[1]/div[8]/input[1]").send_keys(Password)
time.sleep(1)
driver.find_element_by_xpath("/html[1]/body[1]/main[1]/div[1]/div[2]/form[1]/div[9]/input[1]").send_keys(Location)
time.sleep(1)
As you can see, the script asks the user to input the information like Password. I was hoping to use the Random Library to generate a-z characters and then save the data to a .txt file.
I already have read a couple of articles and watched a few videos, but I can't seem to connect the dots on how to use Random Library with Python Files together and make it work.
What I want to do is this:
driver.find_element_by_xpath("/html[1]/body[1]/main[1]/div[1]/div[2]/form[1]/div[7]/input[1]")
# generate the password, send it to the field and save it to .txt file
Aucun commentaire:
Enregistrer un commentaire