具有INPUT id = Submit1的应用程序HTML标记。 IE / HTML驱动程序中所有Xpath的系统返回错误。我在Firefox / Chrome中找不到错误。
//driver.findElement(By.xpath("//input[@id='submit']")).click();
//driver.findElement(By.xpath("//textarea[@name='Textarea1']/input[1]")).click();
//driver.findElement(By.xpath("//textarea[input/@name='submit1']")).click();
//driver.findElement(By.xpath("//input[@id='submit1'][@type='submit']")).click();
//driver.findElement(By.xpath("//input[@id='submit1']/input[1]")).click();
/driver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div[2]/article/div/table/tbody/tr["+1+"]/td["+1+"]")).getText();
//driver.findElement(By.xpath("//table/tbody/tr[2]/td[1]/input[@value='submit']")).click();
driver.findElement(By.xpath("//table[@value='submit']/tbody/tr[2]/td[1]")).click();
<BODY style="FONT-FAMILY: Tahoma"><P> </P>
<P>
<TABLE style="POSITION: absolute; WIDTH: 784px; FONT-FAMILY: Tahoma; TOP: 5px; LEFT: 5px">
<TBODY>
<TR>
<TD style="BACKGROUND-COLOR: #3c4482; WIDTH: 768px"><IMG src="http://www.commidea.com/images/layup/logo.gif"></TD>
<TD vAlign=top align=left></TD></TR>
<TR>
<TD style="WIDTH: 768px"><BR>Standard Txn Authorisation Request Request:<BR><BR><TEXTAREA onblur="return Textarea1_onblur()" style="WIDTH: 800px; HEIGHT: 240px" id=Textarea1 name=Textarea1><?xml version="1.0"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProcessMsg xmlns="https://www.commidea.webservices.com">
<Message>
<ClientHeader xmlns="https://www.commidea.webservices.com">
<SystemID>7140</SystemID>
<SystemGUID>B6DCE5B6-B2FC-472B-9C79-407FF8005994</SystemGUID>
<Passcode>44275733</Passcode>
<ProcessingDB>UK5MIDB025V3A1</ProcessingDB>
<SendAttempt>0</SendAttempt>
</ClientHeader>
<MsgType xmlns="https://www.commidea.webservices.com">TXN</MsgType>
<MsgData xmlns="https://www.commidea.webservices.com">
<![CDATA[<transactionrequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="TXN">
<merchantreference>TEST</merchantreference>
<accountid>14614</accountid>
<txntype>01</txntype>
<transactioncurrencycode>826</transactioncurrencycode>
<apacsterminalcapabilities>4298</apacsterminalcapabilities>
<capturemethod>11</capturemethod>
<processingidentifier>1</processingidentifier>
<tokenid>0</tokenid>
<pan>4485123123123123</pan>
<track2></track2>
<csc></csc>
<avshouse></avshouse>
<avspostcode></avspostcode>
<expirydate>0912</expirydate>
<issuenumber></issuenumber>
<startdate></startdate>
<txnvalue>9.50</txnvalue>
<cashback>0.00</cashback>
<gratuity>0.00</gratuity>
<authcode></authcode>
<transactiondatetime></transactiondatetime>
<vgistransaction>0</vgistransaction>
</transactionrequest>]]></MsgData>
</Message>
</ProcessMsg>
</soap:Body>
</soap:Envelope></TEXTAREA><BR><INPUT id=Submit1 onclick="return Submit1_onclick()" value=submit type=submit><BR></TD>
<TD style="WIDTH: 3px"></TD>
<TD></TD></TR>
<TR>
<TD style="WIDTH: 768px; HEIGHT: 110px"><BR>Standard Txn Authorisation Request Response:<BR><BR><TEXTAREA style="WIDTH: 800px; HEIGHT: 153px" id=TextArea2></TEXTAREA></TD>
<TD style="WIDTH: 3px; HEIGHT: 110px"></TD>
<TD style="HEIGHT: 110px"></TD></TR></TBODY></TABLE></P>
<P> </P></BODY>
请帮我讲解如何为HTML标签提供Xpath。我查看了一些谷歌,但对我的html结构标签没有帮助
答案 0 :(得分:0)
如果定位器在FF / Chrome上运行而不在IE上,那么它就不能编码问题。尝试在IE失败的位置添加一些额外的等待。我曾经遇到类似的情况,额外的等待解决了它