title: how to validate the pdf viewer in browser
body: <p>I have a button as 'PDF View' and once i click, it opens a another new browser window as a pdf viewer and i navigated to second window. Here i am trying to validate whether some pdf content is displayed on that page. I do not need to validate any pdf text but just need to validate some content is available. 
  Here i try to validate the div tag (with id) is present and displayed on the browser window and for some reason it is not identifying that element. Please help me with whats wrong with my code. Any other suggestion or solution to validate would be helpful here.</p>
  
  <pre><code>Title of the browser is : Application V5 - PDF Viewer
  URL of the browser is : https://sample.com/preferences/pdfviewer.jsp
  </code></pre>
  
  <p>the respective html code is</p>
  
  <pre><code>&lt;div id="content"&gt;
      &lt;embed id="plugin" type="application/x-google-chrome-pdf" src="https://sample.com/servlet/pdfviewer" stream-url="chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/23576f4e-363a-4f60-a63a-b770beb66c41" headers="Cache-Control: private
  Connection: Keep-Alive
  Content-Disposition: inline; filename=image.pdf
  Content-Length: 23721
  Content-Type: application/pdf
  Date: Thu, 09 Jan 2020 18:53:13 GMT
  Expires: Thu, 09 Jan 2020 18:53:18 GMT
  Keep-Alive: timeout=5, max=98
  Server: Apache
  " background-color="0xFF525659" top-toolbar-height="56" javascript="allow" top-level-url="undefined"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My script has </p>
  
  <pre><code>WebElement pdfViewButton = browser.findElement(By.id("frmResults:btnPdfView"));
  pdfViewButton.click();
  
  WebDriverWait wait = new WebDriverWait(browser, 60);
  wait.until(ExpectedConditions.numberOfWindowsToBe(2));
  
  Set&lt;String&gt; AllWindowHandles = browser.getWindowHandles();
  String window1 = (String) AllWindowHandles.toArray()[0];
  scenario.write("Currently in Parent Window = " + AllWindowHandles.toArray()[0]);
  scenario.write(browser.getCurrentUrl());
  scenario.write(browser.getTitle());
  scenario.write(String.valueOf(AllWindowHandles.size()));
  
  String window2 = (String) AllWindowHandles.toArray()[1];
  scenario.write("Switching to Child (Viewer) window = " + AllWindowHandles.toArray()[1]);
  browser.switchTo().window(window2);
  scenario.write(browser.getCurrentUrl());
  scenario.write(browser.getTitle());
  wait.until(ExpectedConditions.presenceOfElementLocated(By.id("content")));
  Screenshot.takeScreenshot(BaseSteps.scenario, browser);
  WebElement pdfViewer = browser.findElement(By.id("content"));
  assertThat(pdfViewer.isDisplayed())
      .overridingErrorMessage("The pdf viewer window is launched, but there is no content is displayed.")
      .isTrue();
  
  browser.switchTo().window(window2).close();
  </code></pre>
  
  <p>here is the error... (error pops at "wait.until" line....</p>
  
  <pre><code>org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.id: content (tried for 60 second(s) with 500 milliseconds interval)
      at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95)
      at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272)
      at Utilities.Common.viewTheContentsWithPDFViewer(Common.java:268)
      at Steps.Steps.Verify_the_pdfviewer_is_launching_with_data_content_for_that_item(Steps.java:157)
      at ✽.And Verify the pdfviewer is launching with data content for that item(Returns.feature:19)
  Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#content"}
    (Session info: chrome=78.0.3904.87)
  </code></pre>