I'm writing a script that loads each file in a folder with pickle! But I don't know how to load each file and then perform an action, finish, and then do it with the next file!
Example of loading cookies with the webdriver:
import pickle
import selenium.webdriver
driver = selenium.webdriver.Firefox()
driver.get("http://www.facebook.com")
cookies = pickle.load(open("cookies.txt", "rb"))
for cookie in cookies:
driver.add_cookie(cookie)
driver.get("http://www.facebook.com")
#then perform an action
There are multiple files cookies1.txt, cookies2.txt, cookies3.txt, ... in a folder but i don't know how to run each file one by one, can someone help me? thank you