英文:
Beautiful Soup Get Data Bind Element
问题
<div class="col-xs-12 col-sm-2">
<span class="small text-muted">法院</span>
</div><div class="col-xs-11 col-xs-offset-1 col-sm-10 col-sm-offset-0">
<span class="small" data-bind="html: model.Court">韦恩镇</span>
from bs4 import BeautifulSoup
response_soup = BeautifulSoup(response.text, 'html.parser')
court = response_soup.find('span', {'class': 'Model.court'}).text
结果是 NONE
我正在尝试获取韦恩镇
韦恩镇不会始终是结果。
任何帮助将不胜感激。
英文:
<div class="col-xs-12 col-sm-2">
<span class="small text-muted">Court</span>
</div><div class="col-xs-11 col-xs-offset-1 col-sm-10 col-sm-offset-0">
<span class="small" data-bind="html: model.Court">Wayne Township</span>
from bs4 import BeautifulSoup
response_soup = BeautifulSoup(response.text, 'html.parser')
court = response_soup.find('span', {'class': 'Model.court'}).text
The result is NONE
I am trying to get Wayne Township
Wayne Township will not always be the result.
Any assistance would be most appreciated.
答案1
得分: 0
我明白了。我必须添加selenium正确的语法是court=browser.find_element(By.XPATH,"//span[@data-bind='html: model.Court']")
英文:
I figured it out. I had to add selenium The correct syntax is court=browser.find_element(By.XPATH,"//span[@data-bind='html: model.Court']")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论