title: Selenium Webdriver.load.strategy unstable
body: <p>I'm having problems loading my page with webdriver. My current (problematic) solution involves using the unstable load with firefox, but I'm open to other solutions. </p>
  
  <p><strong>The Core Problem</strong>
  The root of all my problems comes from the fact my page will never fully load when I call it normally with webdriver, and thus will never preform the 2nd step, it's just always loading. It loads fine when you just go to the site with a normal browser. I've tried out a few work arounds that work intermittently, including opening the driver to google, and then going to the page which sometimes makes it load, and with </p>
  
  <pre><code>IJavaScriptExecutor js = (IJavaScriptExecutor)Driver;
  js.ExecuteScript("return window.stop");
  </code></pre>
  
  <p>as suggested by <a href="https://stackoverflow.com/questions/22404581/do-not-wait-for-page-to-load">this question</a>, which sometimes makes it continue without loading. But neither of those work consistently at all (probably &lt;50% of the time) </p>
  
  <p>The best I've got so far is using the unstable load strategy. However that has its own different problems, all of which only happen sometimes.</p>
  
  <p>1) Sometimes it doesn't wait for the page to load at all, and I get an "Unable to locate element:" exception within milliseconds of loading the page, despite the fact that I have a wait set up:</p>
  
  <pre><code>new WebDriverWait(cdriver, 30).until(ExpectedConditions.visibilityOf(cdriver.findElement(By.id(myId))));
  </code></pre>
  
  <p>Thread.sleep(3000); solves that problem, but I've read that is a sloppy way to do things. </p>
  
  <p>2) If I get passed that step, my test should click one link, then click another and continue on with the test. However, it often gets stuck after that first click. So if my code is like this:</p>
  
  <pre><code>    Thread.sleep(3000);
     element1.click();
       System.out.println("clicked!");
      element2.click();
  </code></pre>
  
  <p>The first click (which doesn't load a new page, by the way, just a pop up on the same page) will work, but then the system will never print out "clicked!", it's stuck in the same way would be loading the page initially (without the unstable load thing). If/when it makes it over that hurdle, I think the rest of the test is fine. </p>
  
  <p>Any ideas 1) why it works sometimes but not others. 2) how to fix it 3) how to just get my page to load in the first place</p>
  
  <p>Thank you!</p>