本文介绍了任何无头浏览器的量角器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用量角器,当我将 chrome 指定为浏览器类型时它可以工作.我正在寻找一个无头浏览器示例代码,我已经寻找了 phantomJs 但我无法运行它们中的任何一个.是否有其他无头浏览器的可用示例?

I am using protractor and it works when I specify chrome as the browsertype. I am looking for a headless browser sample code, I have looked for phantomJs but I could not run any of them. Is there a working sample available of another headless browser?

推荐答案

除了 PhantomJS 之外没有其他无头浏览器,而后者是 Protractor 的死胡同.

No other headless browser out there besides PhantomJS while the latter is a dead-end with Protractor.

你可以试试 docker-selenium 或者,如果你不喜欢 Docker 你可以自己用 ubuntu-headless 示例.两种解决方案都提供 Chrome 和Firefox 使用 Xvfb 即使没有真正的 DISPLAY.

You can try docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome & Firefox by using Xvfb even though there is no real DISPLAY.

UPDATE 2 似乎可以在 OSX 中运行 Xvfb:http://xquartz.macosforge.org/landing/

UPDATE 2 Seems to be possible to run Xvfb in OSX: http://xquartz.macosforge.org/landing/

更新 1 Mac OSX selenium 无头解决方案:

UPDATE 1 Mac OSX selenium headless solution:

所以可以在 mac 上测试 selenium 无头.不是真的无头,而是作为另一个用户,所以它不会干扰您当前的用户显示.为此,您需要 kickstart:http://support.apple.com/en-us/HT201710开始使用 kickstart 实用程序

So can test selenium headless on mac. Not headless really but as another user so it doesn't interfere with your current user display.To do this you need kickstart: http://support.apple.com/en-us/HT201710Begin using the kickstart utility

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent

激活远程桌面共享,为所有用户启用访问权限并重新启动 ARD 代理:

Activate Remote Desktop Sharing, enable access privileges for all users and restart ARD Agent:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all

仅限 Apple Remote Desktop 3.2 或更高版本

允许所有用户访问并授予所有用户完全访问权限

Apple Remote Desktop 3.2 or later only

Allow access for all users and give all users full access

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all

Kickstart 帮助命令

Kickstart help command

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help

这篇关于任何无头浏览器的量角器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!