title: Need to get values from Xml and Print on the Console?
body: <p><a href="https://i.stack.imgur.com/iPKvO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iPKvO.png" alt="enter image description here"></a>I want to print the values on Console, I'm unable to print the values on Console and not throwing any error
  This is my code:
      public void payload(WebDriver driver, BaseTest basetest) throws Exception {
          List PayloadXml = driver.findElements(By.xpath("//tr[@ng-repeat='field in fields']"));
          System.out.println("payload");</p>
  
  <pre><code>    for (WebElement P : PayloadXml)
          System.out.println(P.getText());
  
      List&lt;WebElement&gt; PayloadXmlvalues = driver.findElements(By.xpath("//div[@class='kbnDocViewer__value']"));
      String payload = "&lt;CreditReturnRequest&gt;";
      for (WebElement V : PayloadXmlvalues)
          System.out.println(V.getText());
  
      for (int i = 0; i &lt;= 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";
  
              try (FileWriter writexml = new FileWriter("src/main/data.xml")) {
                  writexml.append(xmlvalues);
  
  
  
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              XPathFactory xpf = XPathFactory.newInstance();
              XPath xpath = xpf.newXPath();
              DocumentBuilder db;
              Document xml;
              String value = null;
              String OrderNumberXml = null;
              String ShipperNumber = null;
              String Name = null;
  
              db = dbf.newDocumentBuilder();
              xml = db.parse(new ByteArrayInputStream(xmlvalues.getBytes("utf-8")));
              value = (String) xpath.evaluate("/CreditReturnRequest//Request//req:Payment//BillToKey", xml,
                      XPathConstants.STRING);
              OrderNumberXml = (String) xpath.evaluate("/CreditReturnRequest//Request//req:Payment//OrderNo", xml,
                      XPathConstants.STRING);
              ShipperNumber = (String) xpath.evaluate("/CreditReturnRequest//Request//req:Payment//PaymentKey", xml, XPathConstants.STRING);
              Name = (String) xpath.evaluate("/CreditReturnRequest//Request//req:Payment//ShipTokey", xml, XPathConstants.STRING);
  
              System.out.println("value:" + value);
              basetest.test.log(Status.INFO,value + "TransactionNumber Printed value successfully");
  
              System.out.println("Order Number:" + OrderNumberXml);
              basetest.test.log(Status.INFO,  OrderNumberXml+ "TransactionNumber Printed value successfully");
              System.out.println("ShipperNumber:" + ShipperNumber);
              basetest.test.log(Status.INFO, ShipperNumber + "TransactionNumber Printed value successfully");
              System.out.println("Name:" + Name);
              basetest.test.log(Status.INFO,  Name + "TransactionNumber Printed value successfully");
              }
  
              break;
          }
  
      }
  </code></pre>