I need to extract the javascript call in the onlick event defined in the following markup:
<div style="cursor: pointer;" onclick='javascript:start("a", "b", "code");'>Click Here</div></div>
This is what I want to extract from onclick as a text string: 'javascript:start("a", "b", "code");'
I am a novice at using MSHTML and this is what I tried so far and I am getting nowhere. Maybe there is a better way to do this?
foreach (mshtml.IHTMLElement elm in (IHTMLElementCollection)doc.body.all)
{
if (elm.getAttribute("onclick", 0) != null)
{
if (elm.getAttribute("onclick", 0).ToString().Contains("javascript:start"))
{
Debug.WriteLine("Found!");
}
}
}