Selenium + Firefox + HTTPS [英] Selenium + Firefox + HTTPS

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

问题描述

好。我知道我正在问一个棘手的问题,但我发布这个,因为我的问题没有得到解决,尽管尝试所有解决方案提供各种链接。



我的约束 - 我不想使用保存的Firefox配置文件来保存网站的证书。

Selenium服务器版本 - 2.0b3



解决方案已尝试 -

1) http://seleniumhq.org/docs/05_selenium_rc.html#handling- https和安全性弹出窗口

浏览器启动程序* firefox

Selenium以trustAllSSLCertificates选项启动。

没有帮助。 FF再次要求保存证书。

2)接受自我签署SSL证书在硒/rel =nofollow noreferrer> http://blog.mogotest.com/2010/04/13/how-to-accept-self-signed-ssl-证书在selenium /

浏览器启动程序* firefoxproxy

Selenium以trustAllSSLCertificates选项开始。

没有帮助。



3) Selenium测试HTTPs信任所有证书为FF工作但不IE浏览器



4)除此之外,我尝试创建我自己的cert_override.txt并填充5个字段,如 https://developer.mozilla.org/En/Cert_override.txt,但获得证书序列号和发行人姓名第五字段的值a如 http://tinyurl.com/ce4vn99 所述,base64编码的字符串并不简单。 5)使用记住证书例外插件的Firefox http://sejq.blogspot.in/2009/01/remember-certificate-exception.html 是另外一个选择,但是我一直无法做一个完整的静音安装的。当我们把xpi文件放到需要的目录下时,下次Firefox启动时,会提示说应该找到插件,并且继续安装。插件不会仅仅反映在浏览器中。如果任何人都可以使用 FULL 静默安装这个,那就太好了!



我想要的只是这个在Firefox 。我对IE和Google Chrome不感兴趣。



提供答案的任何帮助,而不只是将其命名为重复。 $ b

解决方案

所以解决方案竟然是上面提到的第五点。
下面是解决这个问题的步骤:
$ b 1)从 https://addons.mozilla.org/zh-CN/firefox/addon/remember-certificate-exception/ < a>



2)解压缩得到一组文件。将它们保存在临时文件夹中。 (temp_folder / extracted_files)
$ b 3)打开install.rdf文件并复制Description节点中存在的em:id节点的内容。



4)将刚刚创建的临时文件夹重命名为
$ b

5)将这个文件夹放在profile_name / extensions /目录。还要从配置文件夹中删除extensions.cache / .ini / .rdf文件。这些需要被删除,以防止用户被提示他的配置文件已被改变,并且有一个新的插件被安装。只有在3个文件被删除的情况下,这个文件才能完全安装。



这可以通过脚本自动完成。

$ $ $ $ $ $


$ b $ / $ / remember_certificate_exception-1.0.0-fx.xpi / tmp / addon
unzip /tmp/addon/remember_certificate_exception-1.0.0-fx.xpi -d / tmp / addon
rm / tmp / addon / remember_certificate_exception- 1.0.0-fx.xpi
folder_name = $(cat /tmp/addon/install.rdf | grep -m 1< em:id>| cut -f2 -d>| cut - f1 -d<)
mv / tmp / addon / tmp / $ folder_name
cp -r / tmp / $ folder_name〜/ .mozilla / firefox / *。default / extensions
rm -f〜/ .mozilla / firefox / *。default / extensions。


Okay. I know that I am asking a hackneyed, overchewed question but I am posting this because my problem is not getting solved despite trying all the solutions provided on various links.

My constraint - I don't want to use a saved firefox profile to save the website's certificate.

Selenium server version - 2.0b3

Solutions tried -
1)
http://seleniumhq.org/docs/05_selenium_rc.html#handling-https-and-security-popups
Browser launcher *firefox
Selenium started with trustAllSSLCertificates option.
Did not help. FF again asks to save the certificate.

2) http://blog.mogotest.com/2010/04/13/how-to-accept-self-signed-ssl-certificates-in-selenium/
Browser launcher *firefoxproxy
Selenium started with trustAllSSLCertificates option.
Did not help.

3) Selenium Testing HTTPs Trust All certificates working for FF but not IE

4) Besides that I tried creating my own cert_override.txt and populating the 5 fields as explained in https://developer.mozilla.org/En/Cert_override.txt but getting the value for the 5th field which is the certificate's serial number and the issuer name as a base64 encoded string is not straightforward as explained in http://tinyurl.com/ce4vn99.

5) Using the Remember Certificate Exception addon for Firefox http://sejq.blogspot.in/2009/01/remember-certificate-exception.html is yet another option but I have not been able to do a full silent install of it. When we drop the xpi file in the required directory, the next time Firefox starts, it will prompt saying that should it found the addon and should it go ahead and install. The addon won't just get reflected in the browser. If anyone can atleast help me with a FULL silent install of this, it would be great!

All I want is that this works in Firefox. I am not interested in IE and Google Chrome.

Any help in providing an answer and not just terming this as a duplicate would be greatly appreciated.

解决方案

So the solution turned out to be the 5th point mentioned above. Here are the steps to solve the issue -

1) Download the Remember Certificate Exception xpi file from https://addons.mozilla.org/en-US/firefox/addon/remember-certificate-exception/

2) Unzip it to get a set of files. Keep them in a temporary folder. (temp_folder/extracted_files)

3) Open the install.rdf file and copy the content of em:id node present in the Description node.

4) Rename the temporary folder just created with this copied string.

5) Place this folder under the profile_name/extensions/ directory. Also delete the extensions.cache/.ini/.rdf files from your profile folder. These need to be deleted so as to prevent the user from being prompted that his profile has been changed and that there is a new addon to be installed. Only if the 3 files are deleted, it will be a fully silent install.

This can be automated using a script.

#!/bin/bash
mkdir /tmp/addon
cp -r ~/POC/remember_certificate_exception-1.0.0-fx.xpi /tmp/addon
unzip /tmp/addon/remember_certificate_exception-1.0.0-fx.xpi -d /tmp/addon
rm /tmp/addon/remember_certificate_exception-1.0.0-fx.xpi
folder_name=$(cat /tmp/addon/install.rdf | grep -m 1 "<em:id>" | cut -f2 -d ">" | cut -f1 -d "<")
mv /tmp/addon /tmp/$folder_name
cp -r /tmp/$folder_name ~/.mozilla/firefox/*.default/extensions
rm -f ~/.mozilla/firefox/*.default/extensions.

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

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