python - 如何使用selenium上传本地文档到百度上
ringa_lee
ringa_lee 2017-04-18 10:29:38
0
4
511

场景是这样的:
1,先登录百度
2,点击上传本地文件

实际场景是点击上传本地文件的按钮后才会出现选定文件的框框

我根据实际场景写了这几行代码:

window=driver.find_element_by_xpath(".//[@id='WKFlashUploader']/embed").click() //点击上传文件按钮
window.send_keys("C:UsersliliDesktopbaidu.txt")//

报了这样的错误

教程是这样的:


哪里不对劲呢

ringa_lee
ringa_lee

ringa_lee

reply all(4)
洪涛

.After click(), the window is the return result of the click() method. If there is no return, the window is None and cannot send_keys

阿神

File upload has been implemented through win32gui

巴扎黑

I use the key wizard, you can also use win32gui

洪涛

First check the window handle to be empty. If it is empty, it will not be processed

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!