Python 中splinter的 Browser.fill( )、.find_by_id( )等函数根据name、id查找元素,html中存在却显示查找不到。为什么?
运行代码如下:
def start(self):
self.driver = Browser(driver_name='chrome')
self.driver.driver.set_window_size(1400,1000)
self.login()
self.driver.visit(self.select_url)
class_name=u"微生物与人类健康"
#测试一:表单填写
#dict={"kcxx":class_name}
#self.driver.fill_form(dict)
#测试二:按id查找元素进行填写
b=self.driver.find_by_id("kcxx").first
b.fill(class_name)
可都显示:ElementDoesNotExist: no elements could be found with id "kcxx",元素不存在。
html如下:
页面如下: