Edit webpage values and submit by button click?

.net c# html html-agility-pack



    <body class=" products show us">

    <header id="header"></header>
    <div id="wrap">
        <div id="container" style="opacity: 1;">
            <div class="sidebar"></div>
            <article itemtype="http://schema.org/Product" itemscope="itemscope">
                    <img id="img-main" src="test.jpg" itemprop="image" alt="test"></img>

        <div id="zoom-lens"></div>
        <div id="zoom-holder" style="background: url("test.jpg") no-repeat scroll 0px 0px transparent;" data-background-image="test.jpg"></div>

<div id="details" data-style-limited-with-count="0" data-style-limited="false">

    <h1 itemprop="name"></h1>
    <p class="style" itemprop="model">


    <p class="description" itemprop="description"></p>
    <ul class="styles "> // STEP 1: GENERATE LIST OF STYLES PER data-style-name and select the one that matches via adding "selected" to a class""!
            <a class="selected" data-style-name="White" data-style-id="10570" data-sold-out="false" data-images="{"detail_url":"..."..."}" href="..." data-no-tubolink="data-no-tubolink"></a>


    <a class="" data-style-name="Black" data-style-id="10571" data-sold-out="true" data-images="{"detail_url":"..."..."}" href="..." data-no-tubolink="data-no-tubolink"></a>


<p class="price" itemtype="http://schema.org/Offer" itemscope="itemscope" itemprop="offers"></p>

<div id="cart-controls">

    <div id="cart-controls"> // STEP 2 => OPEN THIS!
        <form id="cart-addf" class="add" method="post" data-remote="true" action="/shop/168934/add" accept-charset="UTF-8">

    <div style="margin:0;padding:0;display:inline"></div> // STEP 3: GENERATE LIST OF OPTIONS (UNKNOWN AMOUNT OF FIELDSETS) AND SELECT OPTION(S)!
        <select id="size" name="size">
            <option value="25134"></option>
            <option value="25135"></option>
            <option value="25136"></option>
        <select id="qty" name="qty">
            <option value="1"></option>
            <option value="2"></option>
            <option value="3"></option>
            <option value="4"></option>
            <option value="5"></option>
            <option value="6"></option>
            <option value="7"></option>
            <option value="8"></option>
        <a class="next" href="..."></a>
    <fieldset id="add-remove-buttons">
        <input class="button" type="submit" value="add to cart" name="commit"></input> // STEP 4: CLICK BUTTON!

                                    <a class="button continue" href="/shop"></a>
                    <script id="cart-controls-add" type="text/x-nano-tmpl"></script>
                    <script id="cart-controls-remove" type="text/x-nano-tmpl"></script>
                    <script id="cart-controls-sold-out" type="text/x-nano-tmpl"></script>
                    <script id="cart-controls-limited" type="text/x-nano-tmpl"></script>
        <footer id="nav" style="opacity: 1;"></footer>
        <script type="text/javascript"></script>
        <script type="text/javascript"></script>
        <script type="text/javascript"></script>



I want to access the HTML code above, change the values, and then submit the data.

To do this, I'm utilizing HTMLAGILITYPACK and C# Net 4.0.

I included four comments in total above in the HTML (4 things in total that is needed).

I wanted to know whether HTMLAGILITYPACK could accomplish the purpose of modifying values and if it was feasible to click a button on the site to submit the altered values.

Regarding this topic, I came across a few references, but I'm not sure how to apply them effectively.

One: zzzz-39-zz

2: zzzz-46 zzzz


 HtmlAgilityPack.HtmlDocument doc = null;
 doc = new HtmlAgilityPack.HtmlDocument();
 doc.LoadHtml(new WebClient().DownloadString("website above that contains that HTML"));
5/23/2017 11:58:11 AM

Popular Answer

I'm not quite clear what you want to do, but I believe you could be on the right route with this:

To modify any JQuery attribute, go here.

See this to modify or add events that will occur when you click anything between zzz-16 zzz.

I don't believe you need to have the button "click itself," else what's the point?:P But inside the JQuery click function you'll likely build, you can make it such that if you click it, it performs the first thing it should do first, and then the second thing after that.

But like Pasty said, I'd want you to clarify a little more. If anything in this article is unclear, feel free to comment and ask.

5/27/2015 2:00:48 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow