AgainMe AgainMe - 1 year ago 73
C# Question

How to get src tag from image?

I'm trying to get the src property from an

The problem's that I get no
of the image, but an empty string. Instead if I remove the
I see the content of
tag (image). What's the problem?
I saw other similar question, but no solution provided working for me.

<div class="clearfix">
<div class="container left">
<div class="logo">
<a href="/teams/japan/japan/1348/">
<img src="" alt="Giappone">

this is my code:

var shieldHomeContainer = nodeCollection.SelectSingleNode("//div[@class='container left']//div[@class='logo']//a//img/@src");

Answer Source

try something like this

var shieldHomeContainer = nodeCollection.SelectSingleNode("//img").Attributes["src"].Value;