Search code examples
c#-4.0webclientview-source

get whole html source of webpage with c# or get data of jquery code with c#


Accourding to this reply we can just see HTML codes which was sent by server to browser.

The "View Source" only shows the source the server sent at the time the browser requested the particular webpage from the server. Therefore, since these changes were made on the client side, they don't show up on the "View Source" because they've been made after the original page has been delivered.To view the live source of the page, you can use the Web Inspector view in webkit browsers, or Firebug in Firefox. These keep track of any changes to the DOM and update the source which you can see.

how can i do in c# to get Whole HTML code even after doing in client side. I can get HTML with Webclient.

Maybe I should work like borwsers in c#. but how?


update

<script id="frmJqrTplCommentItem" type="text/x-jquery-tmpl">
{{each Comments}}
<li>
    <div class="user-comment-container" itemprop="review" itemscope itemtype="http://schema.org/Review">
        <div class="user-comment-header clearfix">
            <div class="user-info right clearfix {{if UserType === 1}}buyer{{else UserType === 2}}DK-expert{{/if}}">

                <h5>
                    {{if FullName === null || FullName === ''}}
                    <span itemprop="author">کاربر مهمان</span>
                    {{else}}
                    <span itemprop="author">${$value.FullName}</span>
                    {{/if}}
                    {{if UserType === 1}}
                    <span>(خریدار این محصول)</span>
                    {{/if}}

                    <meta itemprop="datePublished" content="${$value.EditDateTime}">
                    <time>${DkUtility.formatDate($value.EditDateTime, 1).FaNumber()}</time>
                </h5>
                {{if IsActive === null || IsActive === false || IsActive === 0}}
                <div class='undercheck'>نظر شما منتظر تایید مدیر می‌باشد </div>
                {{/if}}
            </div>....

for example above code is part of html code inside of webpage. i know this side will execute in client side. can i access {Comments} ??


Solution

  • Short answer - You can't. Evaluating the entire page including all client side HTML changes would require you to develop a full web browser.