title: Selenium java - switch to and read xml tab
body: <p>I'm working in a simple html page that contains a button that open a new tab without "!doctype", and I need to analyze it and go back to the first page</p>
  
  <p>Apparently it is an html page that contains an xml, but I need another solution in Selenium.</p>
  
  <p>I tried this, but I got timeout in </p>
  
  <blockquote>
    <p>webDriverInstance.switchTo().window(windowTab);</p>
  </blockquote>
  
  <pre><code>public void switchTab(String url) {
  
          try {
              for (String windowTab : webDriverInstance.getWindowHandles()) {
                  webDriverInstance.switchTo().window(windowTab);
  
                  if (webDriverInstance.getCurrentUrl().contains(url))
                      break;
              }
          } catch (Exception e) {
              log.debug("Não foi possivel trocar aba", e);
          }
          setWait();
      }
  </code></pre>
  
  <p>View Page
  <a href="https://i.stack.imgur.com/UeloS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UeloS.png" alt="enter image description here"></a>
  Source page
  <a href="https://i.stack.imgur.com/IxrLf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IxrLf.png" alt="view-source"></a>
  I thought I would find the answer on this question but it was not exactly my scenario</p>
  
  <p><a href="https://stackoverflow.com/questions/23296632/how-to-read-xml-embedded-in-the-page-i-want-to-get-compare-the-value-of-exporti">How to read xml embedded in the page? I want to get compare the value of exportid present in xml structure?</a></p>