Selenium - Cross domain and HTTPS problem

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-02 07:21:08

问题


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!


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/3615722/selenium-cross-domain-and-https-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!