Thursday, January 20, 2011

this.onXhrStateChange.bind is not a function

Recently I require to work with the proxy injection mode. And as soon as I endup setting selenium for proxy injection mode I got following error.

this.onXhrStateChange.bind is not a function on session  ad4cf7d3106f4f379a27af514bd1ff5d

I tried a lot and finally got the solution. Though using this solution I am not getting above error anymore, browser is opening but some of the other command is failing, like waitforpagetoload.

Solution:
  1.  Download the source code of selenium-java-client-driver.Jar file and extract that into one folder 
  2. Open the file DefaultSelenium.Java and replace the "public void open(String url)" function with the following.
    public void open(String url) {
                    commandProcessor.doCommand("open", new String[] {url,"true"});
        } 
  3. Recompile the file and create new JAR 
  4. Replace the JAR with original JAR, Build the project again and then Run.