我知道这个问题似乎以前曾被问过,但当我尝试模仿其他人的回答时,仍然存在问题。
我的代码是:
table = driver.find_element_by_xpath('//*[@id="tabdocsumtable"]/tbody')
entries = table.find_elements_by_class('rprt')
我正在获取
AttributeError: 'WebElement' object has no attribute 'find_element_by_class'
网页链接:https://www.ncbi.nlm.nih.gov/clinvar/?term=setx%5Bgene%5D
最佳答案
根据the python binding docs ,看起来 python 的方法是 find_elements_by_class_name
。
所以这一行:
entries = table.find_elements_by_class('rprt')
应该是:
entries = table.find_elements_by_class_name('rprt')
关于python - Selenium 在元素中查找元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44441701/