Python - Firefox Headless [英] Python - Firefox Headless

查看:23
本文介绍了Python - Firefox Headless的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几天我一直在将 Selenium、Tor 和 Firefox 作为多个任务的组合进行处理.我设法用 Python 编写了一个简单的脚本,它通过 Selenium 控制 Firefox,而 Firefox 连接到 Tor 以保护隐私.

I've spent the last few days messing around with Selenium, Tor, and Firefox as a combination for multiple tasks. I've managed to write a simple script in Python that takes control of Firefox through Selenium, while Firefox is connected to Tor for privacy.

现在,我正在寻找一种节省资源的方法,所以我想到了在无头模式下运行 Firefox,我认为这是一个常见功能,但似乎并非如此.我正在寻找一种方法来做到这一点.它是 Firefox 而不是某些基于终端的浏览器的原因是因为我在 Firefox 中使用了扩展名TorButton".它内置了 javascript 注入,有助于保护隐私.

Now, I'm looking for a way to save resources, so I thought of running Firefox in headless mode, which I thought was a common feature but it doesn't seem to be that. I'm looking for a method to do just that. The reason for it being Firefox and not some terminal based browser is because of the extension "TorButton" that I'm using within Firefox. It has javascript injections built in to it that help with privacy.

如果有人以前做过这个(我相信很多人都做过!),我们将不胜感激,谢谢!

If anyone has done this before (which I'm sure many have!), some tips would be greatly appreciated, thank you!

推荐答案

xvfb 是执行此操作的常用方法.搜索selenium xvfb"应该可以找到很多,比如:

xvfb is a common way of doing this. Searching for "selenium xvfb" should find lots, such as:

这篇关于Python - Firefox Headless的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆