pyautogui不会从csv的列表中键入

时间:2018-07-13 14:16:35

标签: python list csv pyautogui

我正在尝试制作一个脚本,该脚本将访问网站并进行搜索,然后单击下载文件按钮。导航工作正常,但我无法从项目列表中键入内容。它根本不输入任何内容。当我尝试print(my_list[i])时,它将打印“ SKU123”。如何获得正确输入该值的信息?

这是完整的代码:

import csv
import pyautogui
import webbrowser
i = 0
pyautogui.PAUSE = 2
with open('test_sku_list.csv' , 'rb') as mycsv:
    reader = csv.reader(mycsv)
my_list = list(reader)

webbrowser.open('website.com', new= 1)

for items in my_list:
    pyautogui.moveTo(0,1) # mouse start point
    pyautogui.moveTo(258, 309, duration = 2) # move to search bar
    pyautogui.click(258, 309, duration = 1.1)# click search bar
    pyautogui.typewrite(my_list[i]) # type index of sting in list
    pyautogui.press('enter') # press enter to search
    pyautogui.moveTo(1198,244, duration = 1) # move mouse to a tab in browser
    pyautogui.click(1198,244,duration  = 1) # click wthat tab
    pyautogui.moveTo(1878, 367, duration = 1) # move to a download button
    pyautogui.click(1878, 367) # click download button
    i += 1

0 个答案:

没有答案