有关使用硒+ pyautogui上传文件的问题
最近,我需要将数据集上传到网站上,第一部分在Selenium上工作正常。
但是,在单击“上传”按钮后,Windows文件Broswer弹出。
在线搜索之后,我终于通过使用Pyautogui,代码:
pyautogui.write('K:\Github\###\data\global\Global_PM_corT.csv') # enter file with path
pyautogui.press('enter') # click ok
我的问题是,我想在GitHub Action上使用上述过程。
所以,我更改了:
'K:\Github\###\data\global\Global_PM_corT.csv'
到:
'./data/global/Global_PM_corT.csv'
这是不起作用的。
我认为在使用Pyautogui的相对路径时存在一些错误。
所以,我想知道是否有人可以帮助我实现这一目标?预先感谢:)
PS 它现在正在工作。
然后,我首先阅读数据集,
pd.read_csv('path')
然后将其写在github操作上
to_csv('C:\\Global_PM_corT.csv')
,然后我可以使用pyautogui使用绝对路径:)
但是,我仍然想知道是否是实现这一目标的更好方法
Recently I need to upload my dataset on a website, the first part works fine on selenium.
However, after I click the 'upload' button, a windows file broswer pops-up.
And after searching online, I finally make it work by using pyautogui, code:
pyautogui.write('K:\Github\###\data\global\Global_PM_corT.csv') # enter file with path
pyautogui.press('enter') # click ok
My question is, I want to use above process on Github Action.
So, i changed:
'K:\Github\###\data\global\Global_PM_corT.csv'
to:
'./data/global/Global_PM_corT.csv'
and it's not working.
I think there is some error when using relative path with pyautogui.
So, i was wondering if someone could help me achieve this? Thanks in advance:)
P.S.
its working right now.
I first read the dataset by
pd.read_csv('path')
then write it on github action
to_csv('C:\\Global_PM_corT.csv')
then I can use absolute path with pyautogui:)
However, I still want to know if a better way to achieve this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
Please try this: