I tried it for several days and still have not been successful in programmatically clicking on this div. All other input fields and buttons work fine using InvokeMember ("click") and RaiseEvent ("onclick"), but I cannot click on the following div:
<div class="pump request"> onclick="$(this).push('kjhzsd94vibjktj584ed01', null, event)" </div>
This div is repeated several times on the page, but I just want to click on the first occurrence.
This is what I have done so far:
HtmlElementCollection c1 = wbc1.document.GetElementsByTagName("div");
foreach (HtmlElement e2 in c1)
{
if (e2.GetAttribute("class").Contains("pump request"))//also this condition is not returning true
{
e2.RaiseEvent("onclick");
}
}
@bleepzter
what if "somecontrol" is a div class instead of a div id?
since in my case I have a div class “pump request”, therefore (if I write “pump request” as somecontrol in the above example), it will return Null to me in someDiv
<div class="pump request"> onclick="$(this).push('kjhzsd94vibjktj584ed01', null, event)" </div>
@Cameron
yep I entered break ;, but the problem is that the if condition never returns true, therefore
HtmlElementCollection c1 = wbc1.document.GetElementsByTagName("div");
foreach (HtmlElement e2 in c1)
{
if (e2.GetAttribute("class").Contains("pump request"))//--> This condition is not returning true
{
e2.RaiseEvent("onclick");
break;
}
}
@ Ilya Kogan
, e2.GetAttribute( "" ), , , div ( ), : -o