Selenium-webdriver w/ Firefox - SSL问题(对等证书的签名无效)。

时间:2022-10-30 19:24:39

This is one of the strangest issues I've run across in quite some time.

这是我在相当长的时间里遇到的最奇怪的问题之一。

We are using selenium-webdriver to drive an instance of Firefox, and part of our task is to visit an HTTPS page. However, upon attempting to do so, the page fails to load and reports that "the peer's certificate has an invalid signature".

我们使用selenium-webdriver来驱动Firefox的一个实例,我们的任务之一就是访问HTTPS页面。但是,在尝试这样做时,页面无法加载并报告“对等者的证书有无效签名”。

Okay, not so strange, right? But here's where it gets kind of strange... the page loads absolutely fine if I open an instance of Firefox, myself, on the exact same box. So, how could this even be happening? Selenium is using the same firefox binary as I would use to browse the web, right?

好吧,没那么奇怪吧?但这里有点奇怪……如果我在同一个盒子上打开Firefox的一个实例,那么页面加载绝对没问题。那么,这怎么可能发生呢?Selenium使用与我浏览web时使用的firefox二进制文件相同,对吗?

If I'm not mistaken, Selenium simply builds a profile each time it's used. Please let me know if this is incorrect. My guess, here, is that it is setting some option or something, somewhere, at the time the browser is loaded, and that this is causing this issue to appear through Selenium, but not when I use Firefox manually.

如果我没弄错的话,Selenium只是在每次使用它时构建一个概要文件。如果这是错误的,请告诉我。我的猜测是,在浏览器加载时,它在某个地方设置了一些选项或其他东西,这会导致这个问题通过Selenium出现,而不是我手动使用Firefox时。

I'm completely at a loss on this one. Does anyone have any clues or information?

我对这件事完全不知所措。有人有任何线索或信息吗?

2 个解决方案

#1


1  

You can solve this by creating Firefox profile and setting up the desired capabilities

您可以通过创建Firefox概要文件和设置所需的功能来解决这个问题

FirefoxProfile fp = new FirefoxProfile();
DesiredCapabilities dc = new DesiredCapabilities.Firefox();
dc.SetCapability(FirefoxDriver.PROFILE,fp);
WebDriver driver = new RemoteWebdriver(dc); 

#2


0  

I solved this problem with the Ruby gem "certified".

我用Ruby gem“certified”解决了这个问题。

#1


1  

You can solve this by creating Firefox profile and setting up the desired capabilities

您可以通过创建Firefox概要文件和设置所需的功能来解决这个问题

FirefoxProfile fp = new FirefoxProfile();
DesiredCapabilities dc = new DesiredCapabilities.Firefox();
dc.SetCapability(FirefoxDriver.PROFILE,fp);
WebDriver driver = new RemoteWebdriver(dc); 

#2


0  

I solved this problem with the Ruby gem "certified".

我用Ruby gem“certified”解决了这个问题。