Solved

XPAth to get an element by id and then get another attribute value

Posted on 2011-03-03
1
392 Views
Last Modified: 2012-08-14
I have the following html on a webpage:

<img id="PageImage" alt="" border="0" usemap="#MapCircular" src="http://krogeratlanta.cntk.mywebgrocer.com/circular/265/pages/B_229323_63B0FE07319F.jpg" />

I am trying to find this img tag by the ID attribute and then grab the value of the SRC attribute. How do I write XPath to do that. This is what I have but it is not working:

//*[@id="pageimage"]/@src
0
Comment
Question by:jtwoods4
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 35030116
XPath (like XML) is case sensitive. Try:
//*[@id="PageImage"]/@src

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now