title: Handle a popup window with selenium
body: <p>I try to automate a download on a webpage using selenium. When I click on a button, a blank popup appears. After about 60 seconds a link appears on that popup. I would like to click on that link. Here is the code I've been using :</p>
  
  <pre><code> //the button that makes the popup appear
   element = driver.SwitchTo().Frame(detailFrame).FindElement(By.XPath("//div[@class='smenu']/input[@value='Imprimer']"));
   //I save the current handle so that I can get back to it later
   currentHandle = driver.CurrentWindowHandle;
   //the finder is supposed to return the handle of the popup
   PopupWindowFinder finder = new PopupWindowFinder(driver);
   string popupWindowHandle = finder.Click(element);
  
   driver.SwitchTo().Window(popupWindowHandle);
   //I wait for the link to appear on the popup
   driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(100));
   driver.FindElement(By.XPath("//body[@class='pop']/descendant::a[@href='/ppm/display_pdf.do']")).Click();
   driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0));
  </code></pre>
  
  <p>Here is the html code of the popup :</p>
  
  <pre><code>&lt;body class=pop onunload=closePopup();&gt;
      &lt;table class=table height="90%" align=center&gt;
          &lt;tbody&gt;
              &lt;tr class=center height="30%"&gt;
                  &lt;td rowSpan=”1” colSpan=”1”&gt;
                      &lt;a href="/ppm/display_pdf.do"&gt;Eng_X82.pdf &lt;/a&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/body&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>But nothing happens, I can't seem to select the link to click on it. Do you see any mistake in my code ?</p>