Diullei / Ghostly

.NET Headless Browser written in C#
MIT License
2 stars 0 forks source link

Not receiving the correct inner HTML from the document #3

Open kgantchev opened 12 years ago

kgantchev commented 12 years ago

Browser browser = new Browser(); string html = "";

browser.Visit( "http://diullei.github.com", () => { html = browser.Run("document.documentElement.innerHTML"); });

I don't get the same HTML as I do with my browser (firefox).

The HTML code resulting from the above call is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

Diullei Gomes
Diullei commented 12 years ago

@kgantchev there is no direct communication phanthomjs and. net. I use ajax calls to make this communication. Since I am using get rather than post the data size is limited. I'll change the code to use to post the results of large size will not be truncated.

Tks again!

Diullei commented 12 years ago

i'll try to work on this issue this weekend :)

kgantchev commented 12 years ago

Ok, thanks.

Diullei commented 12 years ago

Problem solved. I also resolved other minor problems and added an overload to pass an argument timeout in seconds with default value of 15 seconds.

Example of a request to page with a large html content. Note that I pass 90 seconds as the amount of timeOut to ensure that the page will be loaded.

browser.Visit(90, "http://pt.wikipedia.org/wiki/Brasil", () =>
{
    result = browser.Run("document.documentElement.innerHTML");
    ...
});

I hope it works well.

kgantchev commented 12 years ago

Great, I'll give it a shot as soon as I get a chance :). Cheers!