我有这个问题,我需要使用selenium webdriver上传文件,Python我正在使用ubuntu。我已经看到了很多这个问题的答案但不适合我。按钮的HTML类似于:
<button class="classes">Update button</button>
这就是全部。
所以如果你看到这里html中没有type = file。
我尝试了'send_keys&#39;按钮就像这样:
driver.find_element_by_id('file_name').send_keys(file_path)
我也尝试使用JS:
driver.execute_script("document.getElementById('filename').value='" + file_path + "';")
所以我的问题是,还有另一种上传文件的方法吗?或者我做错了什么?
我将不胜感激任何帮助。