Selenium - 跨域和 HTTPS 问题
我使用 Selenium 来测试我的网站。该网站需要访问外部目录才能从中选择一些项目。问题是该目录是通过 HTTPS 协议发布在另一个域上的。我在互联网上搜索并阅读了许多有关 Selenium 和跨域问题的主题,但我仍然没有找到答案。有些主题说*iehta浏览器会解决这个问题,但实际上它做不到。我也尝试了 *iexplore、*iexploreproxy、*firefox、*firefoxproxy,但结果是相同的。您能给我这个问题的解决方案吗?
提前致谢!
I use Selenium to test my website. The website need to access an external catalog to select some items from it. The problem is this catalog is published on another domain with HTTPS protocol. I've searched and read many topics on the internet about Selenium and Cross domain problems, but I still don't find the answer yet. Some topics said that the *iehta browser will overcome this issue, but in fact it could not do that. I also try *iexplore, *iexploreproxy, *firefox, *firefoxproxy as well, but the results are the same. Could you please give me the solution for this problem?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已成功使用 -trustAllSSLCertificates 选项。
首先使用正常的 IE 连接访问该网站,您会收到消息:
此网站的安全证书存在问题。
然后:
单击“继续访问此网站”(不推荐)。 strong>
您会看到浏览器顶部有一个红色的“证书错误”框。
单击该按钮,单击“查看证书”,然后单击“添加”并将证书添加到“受信任的根证书颁发机构”。在上一个答案的“mogotest”链接中有此过程的类似屏幕截图。
现在使用 -trustAllSSLCertificates 选项运行 Selenium,然后您就可以离开了。
I've used the -trustAllSSLCertificates option with success.
Go to the site first with a normal IE connection, you get the message:
There is a problem with this website's security certificate.
Then:
Click Continue to this website (not recommended).
You'll see there's a red "Certificate Error" box at the top of the browser.
Click that, click "View Cetificates" then "Add" and add the certificate to the "Trusted Root Certification Authorities". There are similar screenshots for this process in the "mogotest" link in the previous answer.
Now run Selenium with the -trustAllSSLCertificates option and you are away.
*iexplore(HTA 模式)和 *firefox(chrome 模式)启动器可以正常工作。 *googlechrome 将在即将发布的 2.0 版本中运行。至于使 SSL 工作的机制,以下文章可能会有所帮助:
http://mogotest.com/blog/2010/04/13/how-to-accept-self-signed-ssl-certificates-in-selenium
The *iexplore (HTA mode) and *firefox (chrome mode) launchers will work just fine. *googlechrome will work in the forthcoming 2.0 release. As for the mechanics of making SSL work, the following article may help:
http://mogotest.com/blog/2010/04/13/how-to-accept-self-signed-ssl-certificates-in-selenium