title: How to locate a dynamic element through Selenium and Python
body: <p>I am writing a crawler with python and selenium webdriver in win10 and firefox.<br>
  I encountered difficulty in understand the page at:  </p>
  
  <p><a href="https://irs.thsrc.com.tw/IMINT/" rel="nofollow noreferrer">https://irs.thsrc.com.tw/IMINT/</a></p>
  
  <p>The page has a pop-up message box.
  The xpath of the a link in the pop-up message box is: </p>
  
  <pre><code>//html/body/div[2]/form[1]/div[2]/div[1]/div[1]/div[1]/div[1]/span[1]/a[1]
  </code></pre>
  
  <p>The html source file returned by selenium webdriver for firefox does not include that tag for the message box. 
  So I send a <code>r = requests.get('https://irs.thsrc.com.tw/IMIT/')</code> to get the html source document again and then I get the tag in the html.</p>
  
  <p>After I got the new html source document with the tags for the pop-up message box, I noticed that this message box is of <code>style:"display:none"</code>.<br>
  I am not sure how that affects the return values of webdriver.  </p>
  
  <p>Supposedly all the actionable tags should be disabled.<br>
  But webdriver told me that they are all displayed and enabled after I find them the tag element with their xpath.<br>
  When I used webdriver to find the a link in the pop-up message box with the xpath in the above, webdriver said the element could not be found. 
  In that case, I could not use webdriver to click the a-link in the pop-up message box. 
  Does anyone know how to make webdriver return the true status of the tag elements ? 
  For example, I would expect webdriver told me that all elements are disabled except for the a-link and the confirmation button in the pop-up message box.<br>
  Any answer and suggestions will be greatly appreciated.  </p>