Clicking a Link on a Web page by using Keywords












0















I want to be able to open supreme's website, (www.supremenewyork.com), go to any of the tabs (shirts, jackets, etc.) and be able to input the keywords of the shirt I want to click on, and then have my program click on it.



I figured out how to get it to automatically click onto checkout and fill out the fields. Here is the html for a random shirt that we will use for example.



https://www.supremenewyork.com/shop/all/shirts



I want to click on the Houndstooth Flannel Zip Up Shirt in the color Red



I have read that you need to use HTMLAgilityPack to be able to type in those inner text's for the keywords. But I think you guys can send me the right way.



Here is the HTML



<article><div class="inner-article"><a style="height:150px;" href="/shop/shirts/gsfge9btl/mkza7miyc"><img width="150" height="150" src="//assets.supremenewyork.com/160974/vi/eYFAEBVxJT0.jpg" alt="Eyfaebvxjt0"></a><h1><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Houndstooth Flannel Zip Up Shirt</a></h1><p><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Red</a></p></div></article>


Here is my code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HtmlAgilityPack;

namespace Supreme
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop");

}

private void button1_Click(object sender, EventArgs e)
{

webBrowser1.Navigate("https://www.supremenewyork.com/shop/accessories");

}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("input"))
{
if (btn.GetAttribute("className") == "button")
{
btn.InvokeMember("Click");
}
}
}

private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop/all/shirts");


}

private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}

private void button4_Click(object sender, EventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("a"))
{
if (btn.GetAttribute("className") == "button checkout")
{
btn.InvokeMember("Click");
}
}
}
}


THANK YOU!










share|improve this question

























  • There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

    – Symon
    Nov 20 '18 at 19:18











  • Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

    – Drewster301
    Nov 20 '18 at 19:20


















0















I want to be able to open supreme's website, (www.supremenewyork.com), go to any of the tabs (shirts, jackets, etc.) and be able to input the keywords of the shirt I want to click on, and then have my program click on it.



I figured out how to get it to automatically click onto checkout and fill out the fields. Here is the html for a random shirt that we will use for example.



https://www.supremenewyork.com/shop/all/shirts



I want to click on the Houndstooth Flannel Zip Up Shirt in the color Red



I have read that you need to use HTMLAgilityPack to be able to type in those inner text's for the keywords. But I think you guys can send me the right way.



Here is the HTML



<article><div class="inner-article"><a style="height:150px;" href="/shop/shirts/gsfge9btl/mkza7miyc"><img width="150" height="150" src="//assets.supremenewyork.com/160974/vi/eYFAEBVxJT0.jpg" alt="Eyfaebvxjt0"></a><h1><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Houndstooth Flannel Zip Up Shirt</a></h1><p><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Red</a></p></div></article>


Here is my code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HtmlAgilityPack;

namespace Supreme
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop");

}

private void button1_Click(object sender, EventArgs e)
{

webBrowser1.Navigate("https://www.supremenewyork.com/shop/accessories");

}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("input"))
{
if (btn.GetAttribute("className") == "button")
{
btn.InvokeMember("Click");
}
}
}

private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop/all/shirts");


}

private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}

private void button4_Click(object sender, EventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("a"))
{
if (btn.GetAttribute("className") == "button checkout")
{
btn.InvokeMember("Click");
}
}
}
}


THANK YOU!










share|improve this question

























  • There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

    – Symon
    Nov 20 '18 at 19:18











  • Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

    – Drewster301
    Nov 20 '18 at 19:20
















0












0








0








I want to be able to open supreme's website, (www.supremenewyork.com), go to any of the tabs (shirts, jackets, etc.) and be able to input the keywords of the shirt I want to click on, and then have my program click on it.



I figured out how to get it to automatically click onto checkout and fill out the fields. Here is the html for a random shirt that we will use for example.



https://www.supremenewyork.com/shop/all/shirts



I want to click on the Houndstooth Flannel Zip Up Shirt in the color Red



I have read that you need to use HTMLAgilityPack to be able to type in those inner text's for the keywords. But I think you guys can send me the right way.



Here is the HTML



<article><div class="inner-article"><a style="height:150px;" href="/shop/shirts/gsfge9btl/mkza7miyc"><img width="150" height="150" src="//assets.supremenewyork.com/160974/vi/eYFAEBVxJT0.jpg" alt="Eyfaebvxjt0"></a><h1><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Houndstooth Flannel Zip Up Shirt</a></h1><p><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Red</a></p></div></article>


Here is my code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HtmlAgilityPack;

namespace Supreme
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop");

}

private void button1_Click(object sender, EventArgs e)
{

webBrowser1.Navigate("https://www.supremenewyork.com/shop/accessories");

}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("input"))
{
if (btn.GetAttribute("className") == "button")
{
btn.InvokeMember("Click");
}
}
}

private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop/all/shirts");


}

private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}

private void button4_Click(object sender, EventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("a"))
{
if (btn.GetAttribute("className") == "button checkout")
{
btn.InvokeMember("Click");
}
}
}
}


THANK YOU!










share|improve this question
















I want to be able to open supreme's website, (www.supremenewyork.com), go to any of the tabs (shirts, jackets, etc.) and be able to input the keywords of the shirt I want to click on, and then have my program click on it.



I figured out how to get it to automatically click onto checkout and fill out the fields. Here is the html for a random shirt that we will use for example.



https://www.supremenewyork.com/shop/all/shirts



I want to click on the Houndstooth Flannel Zip Up Shirt in the color Red



I have read that you need to use HTMLAgilityPack to be able to type in those inner text's for the keywords. But I think you guys can send me the right way.



Here is the HTML



<article><div class="inner-article"><a style="height:150px;" href="/shop/shirts/gsfge9btl/mkza7miyc"><img width="150" height="150" src="//assets.supremenewyork.com/160974/vi/eYFAEBVxJT0.jpg" alt="Eyfaebvxjt0"></a><h1><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Houndstooth Flannel Zip Up Shirt</a></h1><p><a class="name-link" href="/shop/shirts/gsfge9btl/mkza7miyc">Red</a></p></div></article>


Here is my code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HtmlAgilityPack;

namespace Supreme
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop");

}

private void button1_Click(object sender, EventArgs e)
{

webBrowser1.Navigate("https://www.supremenewyork.com/shop/accessories");

}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("input"))
{
if (btn.GetAttribute("className") == "button")
{
btn.InvokeMember("Click");
}
}
}

private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://supremenewyork.com/shop/all/shirts");


}

private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}

private void button4_Click(object sender, EventArgs e)
{
foreach (HtmlElement btn in
webBrowser1.Document.GetElementsByTagName("a"))
{
if (btn.GetAttribute("className") == "button checkout")
{
btn.InvokeMember("Click");
}
}
}
}


THANK YOU!







c# html






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 20:04









Symon

750321




750321










asked Nov 20 '18 at 19:05









Drewster301Drewster301

61




61













  • There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

    – Symon
    Nov 20 '18 at 19:18











  • Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

    – Drewster301
    Nov 20 '18 at 19:20





















  • There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

    – Symon
    Nov 20 '18 at 19:18











  • Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

    – Drewster301
    Nov 20 '18 at 19:20



















There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

– Symon
Nov 20 '18 at 19:18





There is a lot of unnecessary information in this post. What is your question? Does the code you provided function/work? If not, what about it is not working? Are you getting an error? Where? In this case- we need to know more about the code

– Symon
Nov 20 '18 at 19:18













Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

– Drewster301
Nov 20 '18 at 19:20







Sorry. I'm trying to use examples and such to help understand. I want to automate a click on a link on a website by finding it by keywords I manually put in. My code works perfectly fine. I just don't know to search for specific keywords in htmls and that is what I was asking about.

– Drewster301
Nov 20 '18 at 19:20














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399863%2fclicking-a-link-on-a-web-page-by-using-keywords%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399863%2fclicking-a-link-on-a-web-page-by-using-keywords%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)