使用python在没有源代码的情况下删除iFrame
我正在尝试从以下html文件中提取iFrame(id=“topic”)的内容: 我尝试使用selenium和beautiful soup,但是代码仍然看不到iFrame中的元素 有没有一种有效的方法可以从这个文件中删除提到的iFrame的内容使用python在没有源代码的情况下删除iFrame,python,selenium,web-scraping,beautifulsoup,python-requests,Python,Selenium,Web Scraping,Beautifulsoup,Python Requests,我正在尝试从以下html文件中提取iFrame(id=“topic”)的内容: 我尝试使用selenium和beautiful soup,但是代码仍然看不到iFrame中的元素 有没有一种有效的方法可以从这个文件中删除提到的iFrame的内容 html文件(最好不使用selenium)?您需要找到iframe的url。 我发现它是https://help.aprimo.com/Content/Marketing_Operations_Help/release_notes/release_no
html文件(最好不使用selenium)?您需要找到
iframe
的url。
我发现它是https://help.aprimo.com/Content/Marketing_Operations_Help/release_notes/release_notes_current_release_activity.html
那么所有代码都是:
import requests
from bs4 import BeautifulSoup
url = "https://help.aprimo.com/Content/Marketing_Operations_Help/release_notes/release_notes_current_release_activity.html"
response = requests.get(url=url).text
soup = BeautifulSoup(response)
# Then it is your work.
但我仍然建议您使用
selenium
。
你可以使用
driver.switch_to.frame(“topic”)
切换到这个iframe
,然后做你想做的事。我建议你可以发布页面的url,这样我们可以更方便地帮助你。当然,你是对的,请查看url:很有效,谢谢!还有一个问题,你在哪里找到了iFrame的url?我试着寻找它,但没有找到。@BVRTOSZ你可以使用Chrome
控制台,执行我发布的图片中的js代码。