0
使用INPUT id = Submit1的應用程序HTML標記。 IE/HTML驅動程序中所有Xpath的系統返回錯誤。我在Firefox/Chrome中找不到錯誤。需要HTML標記中的按鈕的Xpath
//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結構標籤
鑑於你試圖找到的元素有'id',爲什麼不跳過XPath,而只是使用'By.id'而不是? – 2014-09-02 11:09:08
你有沒有告訴我們錯誤信息是什麼? – LarsH 2014-09-02 14:29:32