Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer 8 无法在Internet Explorer上禁用证书吊销(证书已过期)_Internet Explorer 8_Webdriver - Fatal编程技术网

Internet explorer 8 无法在Internet Explorer上禁用证书吊销(证书已过期)

Internet explorer 8 无法在Internet Explorer上禁用证书吊销(证书已过期),internet-explorer-8,webdriver,Internet Explorer 8,Webdriver,显然,我使用SeleniumWebDriver进行自动测试的站点上有一个过期的证书。我曾尝试在Internet设置中禁用证书吊销,并重新启动IE(以及Windows,只是为了安全起见),但没有成功 我还尝试使用Webdriver浏览警告页面,但也没有成功。出于某种原因,它无法检测页面上的“Continue”按钮,无论是使用xpath还是内置的“By.id”定位机制。我对这个问题的WebDriver解决方案持开放态度,但我更喜欢允许我禁用证书吊销的解决方案。除了在虚拟机上进行自动测试之外,我不使用

显然,我使用SeleniumWebDriver进行自动测试的站点上有一个过期的证书。我曾尝试在Internet设置中禁用证书吊销,并重新启动IE(以及Windows,只是为了安全起见),但没有成功

我还尝试使用Webdriver浏览警告页面,但也没有成功。出于某种原因,它无法检测页面上的“Continue”按钮,无论是使用xpath还是内置的“By.id”定位机制。我对这个问题的WebDriver解决方案持开放态度,但我更喜欢允许我禁用证书吊销的解决方案。除了在虚拟机上进行自动测试之外,我不使用IE,所以我不担心安全问题

以防WebDriver是唯一的选项,以下是页面的源代码

<HTML dir=ltr><HEAD><TITLE>Certificate Error: Navigation Blocked</TITLE><LINK rel=stylesheet type=text/css href="ErrorPageTemplate.css">
<META name=MS.LOCALE content=EN-US>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META content=Yes http-equiv=MSThemeCompatible>
<SCRIPT language=javascript type=text/javascript src="errorPageStrings.js">
</SCRIPT>

<SCRIPT language=javascript type=text/javascript src="httpErrorPagesScripts.js">
</SCRIPT>

<SCRIPT language=javascript type=text/javascript src="invalidcert.js">
</SCRIPT>
</HEAD>
<BODY class=securityError onload="BodyLoad(); initMoreInfo('infoBlockID');">
<TABLE border=0 cellSpacing=0 cellPadding=0 width=730><!-- Main title -->
<TBODY>
<TR>
<TD id=shieldIconAlign vAlign=top rowSpan=3 width=60 align=left><IMG id=shieldIcon alt="Shield icon" src="red_shield_48.png"> </TD>
<TD id=mainTitleAlign vAlign=center width=* align=left>
<H1 id=mainTitle>There is a problem with this website's security certificate.</H1></TD></TR>
<TR>
<TD>
<H3>
<DIV id=linkdiv name="linkdiv"></DIV></H3></TD></TR>
<TR><!-- This row is for the the divider-->
<TD id=errorCodeAlign class=errorCodeAndDivider align=right>&nbsp; 
<DIV class=divider></DIV></TD></TR><!-- Error Body -->
<TR>
<TD></TD>
<TD>
<H3>
<DIV style="DISPLAY: none" id=CertUnknownCA name="CertUnknownCA"></DIV>
<DIV style="DISPLAY: block" id=CertExpired name="CertExpired">The security certificate presented by this website has expired or is not yet valid.</DIV>
<DIV style="DISPLAY: block" id=CertCNMismatch name="CertCNMismatch">The security certificate presented by this website was issued for a different website's address.</DIV>
<DIV style="DISPLAY: none" id=CertRevoked name="CertRevoked"></DIV><NOSCRIPT id=securityCert1></NOSCRIPT><BR><ID id=securityCert2>Security certificate problems may indicate an attempt to fool you or intercept any data you send to the server.</ID> </H3></TD></TR><!-- Recommendation-->
<TR>
<TD>&nbsp;</TD>
<TD>
<H2 id=recommendation><B>We recommend that you close this webpage and do not continue to this website. </B></H2></TD></TR><!-- close webpage-->
<TR>
<TD>&nbsp;</TD>
<TD id=closeWebpageAlign vAlign=center align=left>
<H4 id=closeWebpage><IMG class=actionIcon border=0 alt="Recommended icon" src="green_shield.png"><A href="javascript:closePage()">Click here to close this webpage.</A> </H4></TD></TR><!-- continue to site-->
<TR>
<TD>&nbsp;</TD>
<TD id=continueToSiteAlign vAlign=center align=left>
<H4 id=continueToSite><IMG id=ImgOverride class=actionIcon border=0 alt="Not recommended icon" src="red_shield.png"><A id=overridelink href="<href>" name=overridelink>Continue to this website (not recommended).</A> </H4></TD></TR><!-- InfoBlock -->
<TR>
<TD id=infoBlockAlign vAlign=top align=right>&nbsp; </TD>
<TD id=moreInformationAlign vAlign=center align=left>
<H4>
<TABLE>
<TBODY>
<TR>
<TD vAlign=top><A onclick="javascript:expandCollapse('infoBlockID', true); return false;" href="#"><IMG id=infoBlockIDImage class=actionIcon border=0 alt="More information" src="down.png"></A> </TD>
<TD vAlign=top><SPAN id=moreInfoContainer><A href="javascript:expandCollapse('infoBlockID', true);">More information</A></SPAN><NOSCRIPT></NOSCRIPT></TD></TR></TBODY></TABLE></H4>
<DIV style="DISPLAY: none" id=infoBlockID class=infoBlock>
<P>
<LI id=errorExpl1>If you arrived at this page by clicking a link, check the website address in the address bar to be sure that it is the address you were expecting. 
<LI id=errorExpl2>When going to a website with an address such as https://example.com, try adding the 'www' to the address, https://www.example.com. 
<LI id=errorExpl3>If you choose to ignore this error and continue, do not enter private information into the website. 
<P></P>
<P id=moreInfoSeeHelpPF>For more information, see "Certificate Errors" in Internet Explorer Help.</P></LI></DIV></TD></TR></TBODY></TABLE></BODY></HTML>
我猜这不起作用,因为属性值没有在引号中指定,所以它是不正确的html

我也试过:

ieDriver.findElement(By.xpath("//a[@href='<href>']")).click();
ieDriver.findElement(By.xpath("//A[@id='<href>']")).click();
ieDriver.findElement(By.xpath(“//a[@href=''”))。单击();
ieDriver.findElement(By.xpath(“//A[@id=''”))。单击();
在哪里


表示实际的URL

我也无法用同样的方法找到周围的标签

注意:这也不适用于我:


我怀疑,因为信任过期的证书并不能缓解安全问题。

如果这是IE正在创建的警报框,您可以尝试使用
。SwitchTo()
我将其用于警报框

  WebDriver.SwitchTo().Alert().Accept();

希望这会有所帮助。好的,一个有效的解决方案就是创建一个具有可接受的结束日期的新证书。只有在您有权访问服务器、管理员有权这样做并且不介意签署您自己的证书(至少是暂时的)的情况下,这才有效。我真的不喜欢这个解决方案,但因为它似乎是对我的问题的一个有效答案,所以我就同意它。我将专门创建一个与WebDriver功能相关的新问题

谢谢AJ,不幸的是这是一个真实的页面。如果它是一个警报,那肯定会让它更容易!
<href>
  WebDriver.SwitchTo().Alert().Accept();