title: How Selenium webdriver locate element with a http response full of JavaScript?
body: <p>I use selenium webdriver to speed up my testing. In my work our website will redirect to paypal for user to finish payment. However, I cannot make selenium webdriver to locate the email and password input field on paypal.</p>
  <p>The sample paypal URL : <a href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token=EC-07L974777B231831F#/checkout/login" rel="nofollow noreferrer">https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token=EC-07L974777B231831F#/checkout/login</a></p>
  <p>A demo of my code may like this:</p>
  <pre><code>    WebDriver m_driver = new FirefoxDriver();
      String redirected_url = &quot;https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token=EC-0AT82163FM860854K#/checkout/login&quot;;
      
      m_driver.get(redirected_url);
      Thread.sleep(15*1000);
      WebElement we = m_driver.findElement(By.xpath(&quot;.//*[@id='email']&quot;));
      we.sendKeys(&quot;login_email&quot;);
      we = m_driver.findElement(By.xpath(&quot;.//*[@id='password']&quot;));
      we.sendKeys(&quot;login_password&quot;);
      we = m_driver.findElement(By.xpath(&quot;.//*[@id='btnLogin']&quot;));
      we.click();
  </code></pre>
  <p>My problem:</p>
  <p>With that code and on the paypal website, I always got an error message of 'no such element' found exception.</p>
  <p>I can locate the element with firepath in Firefox but I cannot make selenium webdriver work.</p>
  <p>I know this error may be caused by the JavaScript in the whole page of the paypal login page. I just don't know how to handle this situation.</p>