Jayx239/BrowseSharp

Jquery support

Opened this issue · 5 comments

Hi

Please implement jquery support so JavaScript can work.

sample :

            BrowseSharp.Browser TmpBrowser
                = new BrowseSharp.Browser();

            TmpBrowser.Navigate(URL);

            var TmpElements 
                = TmpBrowser.Document.GetElementsByClassName("ok_button");

            if (TmpElements.Length == 1)
            {
                ((IHtmlElement)TmpElements[0]).DoClick();
                return true;
            }

And the html element is defined like this

Hey I don't want you to think I forgot about this. I am working on it, just having trouble finding the time right now.

Hi

Back from my holidays. If you could give me some hints on how to contribute I am willing to spend some time on this.

Regards

Hi,
For starters, I am working off of the refactor branch. I'm currently refactoring the whole project so the next release. At the moment I am cleaning some stuff up and will commit it shortly and give you more details on what to look at.

Hey I just pushed a change with jQuery actually functioning (see

engine.Execute("(function($, window, document){$('#Area1').text('hello there');})(window.jQuery, window, window.document);");
string newValue = engine.Execute("$('#Area1').text()").GetCompletionValue().ToString(); // This is the value set in the previous line with jquery
string newValueFromDOM = window1.document.GetElementById("Area1").TextContent; // Get new value from DOM
).

One issue I found was that some of functions in the jQuery library were causing exceptions to be thrown when being executed with the jint engine. I currently have a modified jQuery file with these problem areas commented out at (https://github.com/Jayx239/BrowseSharp/blob/refactor/BrowseSharpPlayground/jquery.js).

I don't have anything else specific that I can point out for you to do at the moment, but if you want to take a look at it and debug to get an idea of how everything works that would be helpful.