我需要自动化HTML5视频播放器页面的截图和缩略图,但是在查看了一些比较流行的无头浏览器(如PhantomJS )之后,它们不支持HTML5视频。
>phantomjs examples\features.js
Detected features (using Modernizr 2.0.6):
Supported:
touch
generatedcontent
fontface
flexbox
canvas
canvastext
postmessage
websqldatabase
hashchange
history
draganddrop
websockets
rgba
hsla
multiplebgs
backgroundsize
borderimage
borderradius
boxshadow
textshadow
opacity
cssanimations
csscolumns
cssgradients
cssreflections
csstransforms
csstransitions
localstorage
sessionstorage
webworkers
applicationcache
svg
inlinesvg
smil
svgclippaths
Not supported:
csstransforms3d
webgl
geolocation
indexeddb
video
audio请注意,上面不支持HTML5视频,支持HTML5视频是什么轻量级无头浏览器?
发布于 2018-06-06 07:14:29
有一个解决方案,但它不是重量。(虽然相当快),现在,您可以使用无头选择运行火狐。这里有些代码是如何使用Selenium来实现的。
options = new FirefoxOptions();
options.addArguments("--headless"); // This will make Firefox to run in headless mode.
System.setProperty("webdriver.gecko.driver", "lib/firefox/geckodriver.exe");
FirefoxProfile profile = new FirefoxProfile();
FirefoxBinary binary = new FirefoxBinary(new File("lib/firefox/firefox.exe"));
options.setBinary(binary);
options.setProfile(profile);
driver = new FirefoxDriver(options);或者,您可以构建PanthomJS来支持HTML5。跟着这个,https://github.com/ariya/phantomjs/issues/10839#issuecomment-331457673
https://stackoverflow.com/questions/33622662
复制相似问题