selenium+python自动化测试4

selenium+python自动化测试4
今天我来介绍一个上传文件的方法:
例如: 在这里插入图片描述

上面的type=file,这种方式来上传文件:
python本身的send_keys这个函数就可以实现。具体代码如下:
driver.find_element_by_css_selector("[type=‘file’]").send_keys(‘C:/Users/dell/Desktop/me.png’)
driver.find_element_by_css_selector("[type=‘button’]").click()
今天小编就讲到这里啦:未完待续

猜你喜欢

转载自blog.csdn.net/weixin_42996498/article/details/83152788