如何选择<li dropdown =“” list =“” using =“” geckofx =“”

时间:2019-03-30 07:00:20

标签: c# geckofx

=“”

我正在尝试选择一个项目从下拉列表中,但是代码不起作用。不确定那里出了什么问题。

来源:

<ul class="squireToolbar-select-list squireToolbar-editor-mode"> <li class="squireToolbar-select-item" data-squire-actions="setTextDirectionLTR"> <i class="fa fa-check"></i> <span translate-context="Option" translate="">Left to Right</span> </li> <li class="squireToolbar-select-item" data-squire-actions="setTextDirectionRTL"> <i class="fa fa-check"></i> <span translate-context="Option" translate="">Right to Left</span> </li> <li class="squireToolbar-dropdown-divider"></li> <li class="squireToolbar-select-item" data-squire-actions="setEditorMode" data-value="text/html"> <i class="fa fa-check"></i> <span translate-context="Composer Mode" translate="">Normal</span> </li> <li class="squireToolbar-select-item" data-squire-actions="setEditorMode" data-value="text/plain"> <i class="fa fa-check"></i> <span translate-context="Composer Mode" translate="">Plain Text</span> </li> <li class="squireToolbar-dropdown-divider"></li> <li class="squireToolbar-select-item" data-squire-actions="sign"> <i class="fa fa-check"></i> <span translate-context="More Toggles" translate="">Sign message</span> </li> <li class="squireToolbar-dropdown-divider"></li> <li class="squireToolbar-select-item" data-squire-actions="addKey"> <i class="fa fa-check"></i> <span translate-context="More Toggles" translate="">Attach Public Key</span> </li> <li class="squireToolbar-dropdown-divider"></li> <li class="squireToolbar-select-item" data-squire-actions="requestReadReceipt"> <i class="fa fa-check"></i> <span translate-context="More Toggles" translate="">Request Read Receipt</span> </li> </ul>

-

GeckoElementCollection ComposerTags = (geckoWebBrowser1.Document.GetElementsByTagName("button"));
                foreach (GeckoElement currentTag in ComposerTags)
                {
                    if (currentTag.GetAttribute("class").Equals("squireDropdown-item-label squireToolbar-action-modeEditor"))
                    {
                        ((GeckoHtmlElement)currentTag).Click();
                        GeckoLIElement fvalue = (GeckoLIElement)currentTag;
                    }
                   
                }

                GeckoElementCollection NormalTags = geckoWebBrowser1.Document.GetElementsByTagName("ul");
                foreach (GeckoElement currentTag in NormalTags)
                {
                    GeckoHtmlElement finalValue = (GeckoHtmlElement)currentTag;
                    if (finalValue.InnerHtml.Equals("Normal"))
                    {
                       
                        finalValue.Click();
                        MessageBox.Show(finalValue.OuterHtml);

                    }

                }


我要点击常规https://i.stack.imgur.com/L8BxT.png

0 个答案:

没有答案