Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Xpath of data displayed in website is : "//*[@id="price"]".
HTML line is : "15.25".

When try to view page source the value 15.25 is not showing.
Here is the piece of page source: -

...
<td colspan="2" style="text-align:center">
									<span id="price" style=" font-size: 1.8em;font-weight: bold;line-height: 20px;"></span>
									<span id="vxRate"></span>
								</td>

...
<script>fetchPrice();</script>
<script>fetchvRate();</script>


What I have tried:

HtmlAgility pack as well as several methodologies from internet.
Posted
Updated 22-Dec-18 17:36pm

1 solution

You can't get the data because the data isn't there.

First, XPath is kind of useless because HTML is NOT XML.

The HtmAgility Pack is your best bet for dealing with HTML.

You haven't supplied enough information, but it would appear that the javascript code loaded with the page is what is putting that data in place. But, since the code doesn't run when you load the page with whatever code you're using, the data doesn't exist.
 
Share this answer
 
Comments
anil_kumar_bhakta 23-Dec-18 6:27am    
you are right. but when we go for element inspect from browser data shown. I think this data is being loaded by the function "fetchPrice()". Here "fetchPrice()" how works i do not know.
Dave Kreskowiak 23-Dec-18 9:50am    
Because in the browser, the javascript gets to run. In your code, when the page source is downloaded, it doesn't.

But then, this is all speculation because you haven't said anything at all about how you're downloading the page source.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900