Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WindowsFormsSelector
- {
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- WebBrowser browser = new WebBrowser();
- browser.DocumentCompleted +=
- new WebBrowserDocumentCompletedEventHandler(OnDocumentLoaded);
- browser.Url = new Uri(@"https://www.mtel.bg/1/mm/auth/mc/auth/ma/index/mo/1");
- }
- private static void OnDocumentLoaded(object sender,
- WebBrowserDocumentCompletedEventArgs e)
- {
- WebBrowser browser = (WebBrowser)sender;
- HtmlElementCollection theElementCollection = default(HtmlElementCollection);
- theElementCollection = browser.Document.GetElementsByTagName("input");
- foreach (HtmlElement curElement in theElementCollection)
- {
- if (curElement.GetAttribute("classname").ToString() == "btn")
- {
- MessageBox.Show(curElement.GetAttribute("Value"));
- }
- }
- // Dispose the WebBrowser now that the task is complete.
- ((WebBrowser)sender).Dispose();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement