我正在写一个脚本,将上传文件从我的本地机器到一个网页。这是url:https://tutorshelping.com/bulkask
,还有一个上传选项。但是我不知道怎么上传。你知道吗
我当前的脚本:
import webbrowser, os
def fileUploader(dirname):
mydir = os.getcwd() + dirname
filelist = os.listdir(mydir)
for file in filelist:
filepath = mydir + file #This is the file absolte file path
print(filepath)
url = "https://tutorshelping.com/bulkask"
webbrowser.open_new(url) # open in default browser
webbrowser.get('firefox').open_new_tab(url)
if __name__ == '__main__':
dirname = '/testdir'
fileUploader(dirname)
我认为pythonwebbrowser包除了打开一个带有特定url的浏览器/选项卡之外,什么都做不了。你知道吗
如果我理解你的问题,你想打开网页,设置文件上传,然后模拟一个按钮点击。你可以试试pyppeteer。你知道吗
免责声明:我从未使用过Python版本,只有JS版本(puppeter)。
一个快速的解决方案是使用类似AppRobotic的个人宏软件,或者直接与Windows弹出窗口和应用程序交互,或者只使用X、Y坐标移动鼠标,单击按钮,然后发送键盘键以在文件中键入或制表符。你知道吗
这样的东西在调整后会起作用,因此它会在您准备好单击“上载”按钮并浏览文件时运行:
相关问题 更多 >
编程相关推荐