Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:52:30+00:00 2026-06-02T22:52:30+00:00

i am actually trying to grap the text from a tag which has some

  • 0

i am actually trying to grap the text from a tag which has some child tags

For example:

<p><span>Child Text </span><span class="price">Child Text</span><br />
I need this text</p>

This is what i am trying

HtmlElement menuElement = browser.Document.GetElementsByTagName("p");
String mytext = menuElement.InnerHtml;   //also tried innerText,OuterHtml,OuterText

UPDATE: I think i have to use Htmlagilitypack, so now my question is how to do this using htmlagilitypack lib, I’m new to it.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:52:33+00:00Added an answer on June 2, 2026 at 10:52 pm

    There are many approaches to this from using regex to web scraping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath.
    add reference and namespace to HtmlAgilityPack and i ‘m using linq(this requires .net 3.5 or better) with the code below you can do that.

    using HtmlAgilityPack;
    using System.Linq;
    

    // these references must be available.

            private void Form1_Load(object sender, EventArgs e)
            {
                var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
                var html = new HtmlAgilityPack.HtmlDocument();
                html.LoadHtml(rawData);
                html.DocumentNode.SelectNodes("//p/text()").ToList().ForEach(x=>MessageBox.Show(x.InnerHtml));
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I'm actually trying to do is put a WebKitView into a ScreenSaver (which
I'm trying to show a UIAlertView before actually deleting a cell from a UITableView
I am trying to get coordinates from GPS (this actually gives the values for
This probably sounds harder than it is. I'm actually trying to chain some animations
I'm actually trying to render an encoded polyline obtained from the Google Map Directions
I am actually trying to initialize vectors in constructors of struct/class. I came up
I am actually trying to replace a part of the string in a text
I was actually trying to find some tutorials on Handlebar.js & I found this
has anyone come across this property? I am actually trying to implement a single
I'm actually trying to read a specific pixel on a window which is hidden

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.