在Python中创建无头的Chrome实例 [英] Creating a headless Chrome instance in Python
问题描述
这个问题描述了我在研究可用Python创建无头Chrome实例的可用选项之后的结论,并要求进行确认或描述更好的方式"的资源.
This question describes my conclusion after researching available options for creating a headless Chrome instance in Python and asks for confirmation or resources that describe a 'better way'.
据我所见,在Python应用程序中使用无头Chrome实例入门的最快方法似乎是使用CEF( http://code.google.com/p/cefpython/). CEFPython似乎还为时过早,因此使用它可能意味着需要进一步自定义,然后才能加载无头的Chrome实例,该实例加载网页(和所需文件),解析完整的DOM,然后让我从Python对其运行任意JS.
From what I've seen it seems that the quickest way to get started with a headless instance of Chrome in a Python application is to use CEF (http://code.google.com/p/chromiumembedded/) with CEFPython (http://code.google.com/p/cefpython/). CEFPython seems premature though, so using it would likely mean further customization before I'm able to load a headless Chrome instance that loads web pages (and required files), resolves a completed DOM and then lets me run arbitrary JS against it from Python.
我是否错过了其他任何更成熟的项目,或者会让我更轻松?
Have I missed any other projects that are more mature or would make this easier for me?
推荐答案
您是否没有考虑过将Chrome驱动程序与Selenium结合使用?
Any reason you haven't considered Selenium with the Chrome Driver?
http://code.google.com/p/selenium/wiki/ChromeDriver
http://code.google.com/p/selenium/wiki/PythonBindings
这篇关于在Python中创建无头的Chrome实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!