Solved

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

Posted on 2011-03-03
1
390 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 74

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 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

20 Experts available now in Live!

Get 1:1 Help Now