Internet explorer 在IE 8中获取Xpath、名称和Id的无效选择异常。在FF浏览器中工作正常

Internet explorer 在IE 8中获取Xpath、名称和Id的无效选择异常。在FF浏览器中工作正常,internet-explorer,exception,selenium,Internet Explorer,Exception,Selenium,页面的HTML如下所示: <DIV class=sso-desktop> <FORM id=frmDefault method=post action=SSOlogin.fcc autocomplete="OFF"><INPUT value=ISO-8859-1 type=hidden name=SMENC> <INPUT value=US-EN type=hidden name=SMLOCALE> <INPUT id=location ty

页面的HTML如下所示:

<DIV class=sso-desktop>
<FORM id=frmDefault method=post action=SSOlogin.fcc autocomplete="OFF"><INPUT value=ISO-8859-1 type=hidden name=SMENC> <INPUT value=US-EN type=hidden name=SMLOCALE> <INPUT id=location type=hidden name=location> <INPUT id=txtTargetDefault value=HTTP://mits-uat.jpmchase.net/ type=hidden name=target> <INPUT value=0 type=hidden name=smauthreason> <INPUT value=CjQJusV3p15WVSKSkff2KzsgkSCcupPBGl/3DhkXK+PbaIZJ3n0AINwJ6jfCCuYg type=hidden name=smagentname> <INPUT type=hidden name=postpreservationdata> 
<DIV class=container>
<DIV class=headerbox>
<DIV class=headertitle>
<H2>SSO Login
<SCRIPT>
                                document.write(' ' + config.server.region);
                                if (config.server.env !== "PROD") {
                                    document.write('<font color="red"> - ' + config.server.env + '</font>');
                                }
                            </SCRIPT>
 AMERICAS<FONT color=red> - QA</FONT> </H2></DIV></DIV>
<DIV class=infobox>
<DIV class=infotitle><SPAN><A href="https://smlogin-qa.jpmchase.net/siteminderagent/sso/about_blue.htm"><IMG alt="Single Sign-On" src="images/signon_logo_transparent.gif" width=118 height=22></A></SPAN> </DIV>
<DIV class=infobody>
<DIV class=infocenter>
<TABLE class=center>
<TBODY>
<TR>
<TD align=right><B>Standard ID:</B></TD>
<TD align=left><INPUT id=txtUserDefault class=logininput tabIndex=1 type=text name=USER></TD>
<TD align=left><A href="https://idserv-qa.jpmchase.net/stdid_search.asp" target=_self>Standard ID Look-up</A></TD></TR>
<TR>
<TD>&nbsp;</TD></TR>
<TR>
<TD align=right><B>Password:</B></TD>
<TD align=left><INPUT id=txtPassDefault class=logininput tabIndex=2 value="" type=password name=PASSWORD></TD>
<TD align=left><A href="https://mytechub.jpmchase.net/SSO/Reset/Qa/" target=_self>Reset/Forgot Password</A></TD></TR></TBODY></TABLE></DIV>
<DIV class=infobtn><INPUT tabIndex=3 onclick="return submitForm();" value=Login type=submit> </DIV></DIV>
<DIV class=infofooter>
<DIV><A href="https://idserv-qa.jpmchase.net/vettingpasswordreset.asp">Reset Vetting Information</A></DIV>
<DIV><A href="javascript:window.open('./sso/help2.htm','helpWindow','width=640,height=380,scrollbars=yes');void(0);">Single Sign-On Help</A></DIV></DIV></DIV></DIV>
<DIV class=tipbox><SPAN><B>Tip:</B> You are able to use the same Standard ID and password on all sites that bear the Single Sign-On logo.</SPAN> </DIV>
<DIV class=alerttext><SPAN>DO NOT BOOKMARK THIS PAGE. DO NOT ADD TO FAVORITES.</SPAN> </DIV></FORM></DIV><!--HTML5 FORM-->
<TABLE style="POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0px; LEFT: 0px" class=sso-html5>
<TBODY>
<TR>
<TD style="HEIGHT: 43px">
<DIV style="HEIGHT: 43px" class="sso-toolbar sso-toolbar-top"><SPAN class=sso-help-icon onclick="document.location='sso/help2.htm';"></SPAN>
<DIV class=sso-toolbar-title>Single Sign-On
<SCRIPT>
                            if (config.server.env !== "PROD") {
                                document.write('<span class="sso-toolbar-env"> - ' + config.server.env + '</span>');
                            }
                        </SCRIPT>
 <SPAN class=sso-toolbar-env>- QA</SPAN> </DIV></DIV></TD></TR>
<TR>
<TD vAlign=top>
<FORM style="WIDTH: 100%" id=frmHTML5 method=post action=SSOlogin.fcc autocomplete="OFF"><INPUT value=ISO-8859-1 type=hidden name=SMENC> <INPUT value=US-EN type=hidden name=SMLOCALE> <INPUT id=location type=hidden name=location> <INPUT id=txtTargetHTML5 value=HTTP://mits-uat.jpmchase.net/ type=hidden name=target> <INPUT value=0 type=hidden name=smauthreason> <INPUT value=CjQJusV3p15WVSKSkff2KzsgkSCcupPBGl/3DhkXK+PbaIZJ3n0AINwJ6jfCCuYg type=hidden name=smagentname> <INPUT type=hidden name=postpreservationdata> 
<DIV class=sso-body>
<DIV class=sso-fieldset>
<DIV class=sso-field>
<DIV class=sso-field-label><SPAN>Standard ID</SPAN></DIV>
<DIV class=sso-field-container><INPUT id=txtUserHTML5 class=sso-input-text type=text name=USER></DIV></DIV>
<DIV class=sso-field>
<DIV class=sso-field-label><SPAN>Password</SPAN></DIV>
<DIV class=sso-field-container><INPUT id=txtPassHTML5 class=sso-input-password value="" type=password name=PASSWORD autocapitalize="off"></DIV></DIV></DIV>
<DIV class=sso-box-center><INPUT onclick="return submitForm();" value=Login type=submit> </DIV></DIV></FORM></TD></TR>
<TR>
<TD style="HEIGHT: 17px">
<DIV style="HEIGHT: 17px" class="sso-toolbar sso-toolbar-bottom">
<DIV class=sso-corporate-logo></DIV></DIV></TD></TR></TBODY></TABLE>
class mits 
{
    void mits1() throws BiffException, IOException
    {
        //WebDriver driver = new FirefoxDriver();

        File file = new File("C:\\Users\\V443938\\Downloads\\IEDriverServer.exe");
        System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

        DesiredCapabilities dc = DesiredCapabilities.internetExplorer();

        dc.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);

        WebDriver driver = new InternetExplorerDriver(dc);
        driver.manage().window().maximize();
        driver.get("https://mits-uat.jpmchase.net/");

        driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);

        //Enter username
        driver.findElement(By.xpath("//INPUT[@id='txtUserDefault']")).sendKeys(new String []{"R277025"});

        //Enter Password
        driver.findElement(By.xpath("//INPUT[@id='txtPassDefault']")).sendKeys("CTcbb314");

        //Click on button
        driver.findElement(By.xpath("//INPUT[@value='Login']")).click();
    }
}
问题:

现在,对于xpath、ID或name的username,我没有得到这样的元素异常。当我在FF中运行代码时。它工作得很好。我不确定Internet Explorer中的xpath、名称和ID是否发生更改。如果是的话,请帮我

FF的xpath和IE的xpath不同吗


注意:应用程序是安全的,在正常情况下不会打开。

您的XPath必须全部小写。看有用

我已经包括了页面源代码和我的代码。请看一看。