I am using HTMLElementCollection, HtmlElement to iterate through a website and using Get/Set attributes of a website HTML and returning it to a ListView. Is it possible to get values from website a and website b to return it to the listview ?

   HtmlElementCollection oCol1 = oDoc.Body.GetElementsByTagName("input");
                foreach (HtmlElement oElement in oCol1)
                {
                    if (oElement.GetAttribute("id").ToString() == "search")
                    {
                        oElement.SetAttribute("value", m_sPartNbr);
                    }
                    if (oElement.GetAttribute("id").ToString() == "submit")
                    {
                        oElement.InvokeMember("click");
                    }
                }


                HtmlElementCollection oCol1 = oDoc.Body.GetElementsByTagName("tr");
                foreach (HtmlElement oElement1 in oCol1)
                {
                    if (oElement1.GetAttribute("data-mpn").ToString() == m_sPartNbr.ToUpper())
                    {
                        HtmlElementCollection oCol2 = oElement1.GetElementsByTagName("td");
                        foreach (HtmlElement oElement2 in oCol2)
                        {
                            if (oElement2 != null)
                            {
                                if (oElement2.InnerText != null)
                                {
                                    if (oElement2.InnerText.StartsWith("$"))
                                    {
                                        string sPrice = oElement2.InnerText.Replace("$", "").Trim();
                                        double dblPrice = double.Parse(sPrice);
                                        if (dblPrice > 0)
                                            m_dblPrices.Add(dblPrice);
                                    }
                                }
                            }
                        }
                    }

Related posts

Recent Viewed