Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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
如何使用Selenium和python下载MHTML网页?_Python_Html_Python 3.x_Selenium_Selenium Chromedriver - Fatal编程技术网

如何使用Selenium和python下载MHTML网页?

如何使用Selenium和python下载MHTML网页?,python,html,python-3.x,selenium,selenium-chromedriver,Python,Html,Python 3.x,Selenium,Selenium Chromedriver,我想使用selenium和python下载.mhtml格式的网页。我正在使用以下代码: driver = webdriver.Chrome() driver.get("http://www.yahoo.com") with open("/path/to/page_source.mhtml", "w", encoding="utf-8") as f: f.write(driver.page_source) 它保存了页面,但页面只有源代码。无法查看页面上的原始内容。有什么建议吗 谢谢 卡兰

我想使用selenium和python下载.mhtml格式的网页。我正在使用以下代码:

driver = webdriver.Chrome()
driver.get("http://www.yahoo.com")
with open("/path/to/page_source.mhtml", "w", encoding="utf-8") as f:
    f.write(driver.page_source)
它保存了页面,但页面只有源代码。无法查看页面上的原始内容。有什么建议吗

谢谢 卡兰