简体   繁体   中英

c# invokemember click not working

I would like to press automatically "Vans, Trucks & Plant" button. After pressing it should come another table with expanded meniu, but invokemember click not working (in all other cases on the same page working well)...

Here is part of the page code:

<div class="category-scroll" data-category-active="2551">
<ul class="category-list-content" style="transition-timing-function: cubic-bezier(0.1, 0.57, 0.1, 1); transition-duration: 0ms; transform: translate(0px, 0px) translateZ(0px);">
<li class="border-b is-parent" data-category-children="true" data-category-id="9312" data-category-url="vans-trucks-plant" data-category-name="Vans, Trucks & Plant">
<span class="category-name">
<span class="category-list-control is-parent"></span>
Vans, Trucks & Plant
</span>
</li></ul>
<div class="iScrollVerticalScrollbar iScrollLoneScrollbar" style="position: absolute; z-index: 9999; width: 7px; bottom: 2px; top: 2px; right: 1px; overflow: hidden;">
</div>

Here is how I do, but no results:

foreach (HtmlElement el in webBrowser.Document.GetElementsByTagName("li"))
{
if (el.InnerText == " Vans, Trucks & Plant  ")
  el.InvokeMember("click");
}

Any suggestions? Maybe I need to invoke some script?

foreach (HtmlElement el in webBrowser.Document.GetElementsByTagName("li"))
{
if (el.InnerText.Contains("Vans, Trucks & Plant"))
  el.InvokeMember("click");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM