如何使用新的geckodriver端点? [英] How to use new geckodriver endpoints?

查看:188
本文介绍了如何使用新的geckodriver端点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的geckodriver v0.17.0有一个新的安装插件的方法,如这里

  POST / session / {session id} / window /全屏调用窗口管理器特定的全屏操作
POST / session / {session id} / moz / addon / install来安装一个扩展[Gecko only]
POST / session / {session id} / moz / addon / $ b

如何使用这些端点将我的插件安装到firefox进行硒测试?

解决方案

您必须知道geckodriver启动的IP和端口。一旦geckodriver启动,您可以从驱动程序实例获取会话ID。



您可以获取IP地址和端口如前所述



例如:如果ip和port是
localhost:15874



和会话ID是 1e53412a-05eb-40a9-8a7b-bb8dd6fd75ab

然后你可以发布一个json消息给

pre $ http $ // localhost:15874 / session / 1e53412a -05eb-40a9-8a7b-bb8dd6fd75ab / moz / addon / install

邮件正文应该是

  {
path:xxyy.xpi,
temporary:true
}


The new geckodriver v0.17.0 has a new way to install addons as mentioned here:

POST /session/{session id}/window/fullscreen to invoke the window manager-specific full screen operation
POST /session/{session id}/moz/addon/install to install an extension [Gecko only]
POST /session/{session id}/moz/addon/uninstall to uninstall an extension [Gecko only]

How can I use these endpoints to install my addon to firefox for my selenium tests?

解决方案

You have to know the ip and port in which geckodriver starts. And Once the geckodriver started you can get the Session Id from the driver Instance.

You can get the Ip Address and Port as mentioned here

For ex: if the ip and port is
localhost:15874

and session id is 1e53412a-05eb-40a9-8a7b-bb8dd6fd75ab

Then you can post a json message to

http://localhost:15874/session/1e53412a-05eb-40a9-8a7b-bb8dd6fd75ab/moz/addon/install

The body of post message should be

{
    "path":"xxyy.xpi",
    "temporary":true
}

这篇关于如何使用新的geckodriver端点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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