我有一个网页,其中有一个通过与我需要单击箭头的接口代码匹配的表。
driver.findElement(By.xpath("//td/descendant::span[contains(text(),'STR_PGW.RETURN')]/parent::tr/td/descendant::button[@class='kbnDocTableOpen__button']")).click();
最佳答案
公共无效负载(WebDriver驱动程序,BaseTest基本测试)抛出异常{
List<WebElement> PayloadXml = driver.findElements(By.xpath("//tr[@ng-repeat='field in fields']"));
System.out.println("payload");
for (WebElement P : PayloadXml)
System.out.println(P.getText());
List<WebElement> PayloadXmlvalues = driver.findElements(By.xpath("//div[@class='kbnDocViewer__value']"));
String payload = "<CreditReturnRequest>";
for (WebElement V : PayloadXmlvalues)
System.out.println(V.getText());
for (int i = 0; i <= PayloadXmlvalues.size(); i++) {
// System.out.println("Content text is : " + PayloadXml.get(i).getText());
// match the content here in the if loop
if (PayloadXml.get(i).getText().contains(payload)) {
String xmlvalues = PayloadXmlvalues.get(i).getText();
String xmlOutputFile = "data.xml";