title: Websocket error in casperjs
body: <p>I am having a problem with casperjs where when i try to access a specific https website, i get an error along the lines of:</p>
  
  <p>Error during WebSocket handshake: location mismatch: "ws://url_path != wss://url_path</p>
  
  <p>I have provided the source code below. I altered urls and removed the assignment of the variable "userState" which is a property that is set on the specific webpage. I just wanted to see if anyone had an idea on how to bypass this error. </p>
  
  <p>I have heard it has to do with phantomjs verson &lt; 2.0 has this error with websockets but casperjs seemingly does not support phantomjs 2.0.</p>
  
  <pre><code>var casper = new require('casper').Casper({verbose: true, logLevel: "debug"});
  
  casper.userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36");
  
  casper.start("https:www.example.com/index.html#home").then(function() {
      this.evaluate(function() {
          if(location.hash === "#home") {
              this.echo("Were on the homepage");
          } else {
              this.echo("We are not home...");
          }
      });
  });
  
  casper.thenOpen("https://www.example.com/index.html#sign-in", function() {
      this.evaluate(function() {
          if (location.hash === "#sign-in") {
              this.echo("Were on the sign in page!!!");
          } else {
              this.echo("We are not at the sign in page were: " + location.hash);
          }
      });
  }); 
  
  casper.thenEvaluate(function() {
      casper.sendKeys('#sign-in-email', "email");
      casper.sendKeys('#sign-in-password', 'password');
  });
  
  casper.thenClick('#sign-in-submit', function() {
      this.echo("We clicked the submit button");
  });
  
  casper.thenEvaluate(function() {
      // userState is an object in the context of the running web app
      if(userState === "full") {
          this.echo("WE HAVE SUCCESSFULLY SIGNED IN!");
      } else {
          this.echo("We were unable to sign in...");
      }
  
  });
  casper.run();
  </code></pre>