56 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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;
 | |
| 
 | |
| namespace WindowsFormsApp1
 | |
| {
 | |
|     public partial class Sales_Details : Form
 | |
|     {
 | |
|         Main main;
 | |
|         public Sales_Details(Main _main)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             main = _main;
 | |
|         }
 | |
|         private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 | |
|         {
 | |
|             if(e.Url.AbsoluteUri == webBrowser1.Url.AbsoluteUri)
 | |
|             {
 | |
|                 string data = "";
 | |
|                 HtmlDocument Doc = webBrowser1.Document;
 | |
|                 for(int a = 0; a < Doc.GetElementsByTagName("a").Count; a++)
 | |
|                 // 소스코드들 중에서 <a> - </a>로 묶인 부분의 수를 구한다.
 | |
|                 {
 | |
|                     if (Doc.GetElementsByTagName("a")[a].GetAttribute("class").IndexOf("bo3") > -1)
 | |
|                     // 그중에서 <a class="bo3"> 이런 식으로 시작되는 부분을 만나면 아래 코드 실행
 | |
|                     {
 | |
|                         data = Doc.GetElementsByTagName("b")[a].InnerText;
 | |
|                         richTextBox1.Text += data + "\n";
 | |
|                         MessageBox.Show(data);
 | |
|                     }
 | |
|                 }
 | |
|                 MessageBox.Show(Doc.GetElementsByTagName("a").Count.ToString());
 | |
| // < a href = "https://www.aladin.co.kr/shop/wproduct.aspx?
 | |
| // ItemId=248012843" class="bo3">
 | |
| // <b>무한도전 낱말퍼즐 : 과학</b>
 | |
| // </a>
 | |
| //*[@id="Search3_Result"]/div[1]/table/tbody/tr/td[3]/table/tbody/tr[1]/td[1]/div[1]/ul/li[1]/a[1]/b
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string programName = "link";
 | |
|             string path = "https://www.aladin.co.kr/search/wsearchresult.aspx?SearchTarget=All&SearchWord="+programName;
 | |
|             //webBrowser1.Navigate(path + programName);
 | |
|             webBrowser1.Navigate(path);
 | |
|         }
 | |
|     }
 | |
| }//*[@id="Search3_Result"]/div[2]/table/tbody/tr/td[3]/table/tbody/tr[1]/td[1]/div[1]/ul/li[1]/a[1]/b
 | 
