我试图让我的脚本的这一部分从文件夹“zip code pics”上传图像,该文件夹包含由可选邮政编码命名的子文件夹
当我到达图片上传页面时,它告诉我错误驱动程序未定义..
我在这里缺少什么?
def picturetime():
zipcode = get_zipcode()
while True:
try:
pics = []
for each in os.listdir(os.path.join(os.curdir, 'ZIP CODE PICS', zipcode[0])):
name = os.path.splitext(each)
picture_name = os.path.join(os.curdir, 'ZIP CODE PICS',zipcode[0] , each)
picture_name = os.path.abspath(picture_name)
pics.append(picture_name)
if pics:
picture_name = random.choice(pics)
driver.find_element_by_id('plupload').send_keys(picture_name)
print('[zip code image] clicking on save_link after picture')
sleep(10)
答案 0 :(得分:0)
def picturetime():
global drive
zipcode = get_zipcode()
.......
.......