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 8217801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:34:30+00:00 2026-06-07T12:34:30+00:00

I am using WatiN and trying to scrape an image URL from a weblink,

  • 0

I am using WatiN and trying to scrape an image URL from a weblink, based on the fields class. Viewing the sites code the images info displays as this:

//images code
<div class="doc-banner-icon">
    <img src="https://website.com/image.jpg">
</div>

//text code
<div id="doc-original-text">
    Once upon a time, in a land far far away...
</div>

What I want to do is use a WatiN call to find that img link. I thought I could use something like the Find.ByClass() call to find specifically that area of the code, but I can’t seem to figure out how to get the line of text contained within that class. When I use the Find.ById() on a different field and sent to string it pulls the text content of that area. Below is what I am trying.

using (myIE)
{
    //loads the website
    myIE.GoTo(txtbxWeblink.Text);            

    string infoText = myIE.Div(Find.ByClass("doc-banner-icon")).ToString();

    //This will successfully return the text fields text.
    string imageText = myIE.Div(Find.ById("doc-original-text")).ToString();
}

EDIT – It appears that I may need to use a different call on myIE, there is also myIE.Image, myIE.Link etc, I don’t know much about this all still so not sure if Div is the right call here.

  • 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-07T12:34:32+00:00Added an answer on June 7, 2026 at 12:34 pm

    Try this…

    string infoText = myIE.Div(Find.ByClass("doc-banner-icon")).Images.First().Src;
    string imageText = myIE.Div(Find.ById("doc-original-text")).Text;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the following code to work using both Watin and HttpWatch.
I'm trying to run Watin from within a TeamCity build, using nUnit. All tests
Hi i'm trying to get a row count from a table using Watin ie
Using Watin, I'm trying to handle a confirm dialog box and tell watin to
I'm trying to upload a file using Watin and C#. Under Windows XP, Watin
I'm using Watin to automate download file from a website. At some point a
I´m trying to get the values of TDs inside a table using WatiN. The
I am trying to click an image during automated testing using Watij. I am
I am trying to return the text for selected value from a select_list using
Based on this article , I've written a custom class which implements the Watin.Core.interfaces.IFindByDefaultFactory,

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.