为了测试,我需要
我如何通过硒来做到这一点?”原因如下:
# hident2 is the name of "Choose File" element
wd.find_element(By.XPATH("//input[@id='hident2']")).sendKeys("C:\\Users\\file-to-upload.xml");
# input.btn.primary is the name of "Upload" button element**
wd.find_element_by_css_selector("input.btn.primary").click()
我得到以下错误:
TypeError: 'str' object is not callable
我做错什么了?在
您没有正确使用
find_element()
方法。将By.XPATH
作为单独的参数传递:或者,使用直接快捷方式:
^{pr2}$或者,只需使用“按id”内置定位器:
另外,该方法称为}。在
send_keys()
,而不是{相关问题 更多 >
编程相关推荐