Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python在没有源代码的情况下删除iFrame_Python_Selenium_Web Scraping_Beautifulsoup_Python Requests - Fatal编程技术网

使用python在没有源代码的情况下删除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文件中提取iFrame(id=“topic”)的内容:

我尝试使用selenium和beautiful soup,但是代码仍然看不到iFrame中的元素

有没有一种有效的方法可以从这个文件中删除提到的iFrame的内容
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代码。