Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- namespace pokebot
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- bool _newSearchFlag = true;
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- //START: variabler
- int topoke = 0;
- int todo = 0;
- bool work = false;
- //SLUTT: variabler
- private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- if (todo == 1)
- {
- while (work)
- {
- HtmlElementCollection links = webBrowser1.Document.GetElementsByTagName("a");
- foreach (HtmlElement link in links)
- {
- /*
- if (link.InnerText.Equals("Poke tilbake"))
- link.InvokeMember("Click");
- */
- if (link.InnerText == "Poke tilbake")
- {
- link.InvokeMember("Click");
- //Thread.Sleep(2000);
- KlikkKnapp("name", "pk01");
- //Thread.Sleep(2000);
- }
- }
- Thread.Sleep(200);
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- todo = 1;
- work = true;
- webBrowser1.Navigate("http://facebook.com");
- }
- private void KlikkKnapp(string attributt, string attVerdi)
- {
- foreach (HtmlElement element in this.webBrowser1.Document.GetElementsByTagName("input"))
- {
- if (element.GetAttribute(attributt).Equals(attVerdi))
- {
- element.InvokeMember("click");
- }
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- work = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement