<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《在Python Selenium中为Chrome和Firefox浏览器开启headless模式》的评论</title>
	<atom:link href="https://greyli.com/python-selenium-headless-for-chrome-firefox/feed/" rel="self" type="application/rss+xml" />
	<link>https://greyli.com/python-selenium-headless-for-chrome-firefox/</link>
	<description>一个编程和写作爱好者的在线记事本</description>
	<lastBuildDate>Wed, 05 Nov 2025 16:05:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.26</generator>
	<item>
		<title>作者：张小影</title>
		<link>https://greyli.com/python-selenium-headless-for-chrome-firefox/#comment-7464</link>
		<dc:creator><![CDATA[张小影]]></dc:creator>
		<pubDate>Tue, 26 May 2020 05:13:41 +0000</pubDate>
		<guid isPermaLink="false">http://greyli.com/?p=1814#comment-7464</guid>
		<description><![CDATA[谢谢哈，但是正常可以使用selenium自带的get_screenshot_as_file()方法截图，但是alert不是网页的一部分，所以截不了.......]]></description>
		<content:encoded><![CDATA[<p>谢谢哈，但是正常可以使用selenium自带的get_screenshot_as_file()方法截图，但是alert不是网页的一部分，所以截不了&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：李辉</title>
		<link>https://greyli.com/python-selenium-headless-for-chrome-firefox/#comment-7462</link>
		<dc:creator><![CDATA[李辉]]></dc:creator>
		<pubDate>Tue, 26 May 2020 04:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://greyli.com/?p=1814#comment-7462</guid>
		<description><![CDATA[我也不太清楚哎，但是 headless 模式的话是没有图形界面出现，所以你的这两种方法肯定不行。你可以试试 Selenium 自带的截图接口。]]></description>
		<content:encoded><![CDATA[<p>我也不太清楚哎，但是 headless 模式的话是没有图形界面出现，所以你的这两种方法肯定不行。你可以试试 Selenium 自带的截图接口。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：张小影</title>
		<link>https://greyli.com/python-selenium-headless-for-chrome-firefox/#comment-7461</link>
		<dc:creator><![CDATA[张小影]]></dc:creator>
		<pubDate>Tue, 26 May 2020 03:27:08 +0000</pubDate>
		<guid isPermaLink="false">http://greyli.com/?p=1814#comment-7461</guid>
		<description><![CDATA[请问在headless模式下，如果页面有alert弹框，自动化测试时该怎样给弹框截图呢？我试了下面这两种方法，都截的时当前电脑的屏幕，不是后台headless的图，请问大神怎么办

方法1：
import pyautogui
im1 = pyautogui.screenshot()
im1.save(&#039;my_screenshot.png&#039;)

方法2：
from PIL import ImageGrab
im = ImageGrab.grab()
im.save(&#039;my_screenshot.png&#039;)]]></description>
		<content:encoded><![CDATA[<p>请问在headless模式下，如果页面有alert弹框，自动化测试时该怎样给弹框截图呢？我试了下面这两种方法，都截的时当前电脑的屏幕，不是后台headless的图，请问大神怎么办</p>
<p>方法1：<br />
import pyautogui<br />
im1 = pyautogui.screenshot()<br />
im1.save(&#8216;my_screenshot.png&#8217;)</p>
<p>方法2：<br />
from PIL import ImageGrab<br />
im = ImageGrab.grab()<br />
im.save(&#8216;my_screenshot.png&#8217;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
