Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2011-03-03
1
Medium Priority
?
399 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 2000 total points
ID: 35030116
XPath (like XML) is case sensitive. Try:
//*[@id="PageImage"]/@src

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

580 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