Tag: invokemember

使用webbrowser单击网页中的按钮

所以我需要做的是使用这段代码: WebBrowser browser = new WebBrowser(); browser.Navigate(“www.somthing.com”); browser.Document.GetElementById(“ID”).InvokeMember(“click”); 然后我需要在页面中找到按钮的ID并放入我的代码,但我的问题是一些按钮没有Id的! 那我该怎么办? 他们只有类型和类以及其他一些东西,但没有Id。 我意识到一些按钮可能是java,也许这就是为什么我不能按照通常的方式点击它们。 所以你知道我该怎么办?

WebBrowser控件中的InvokeMember(“单击”)

网站显示基于表格的选项供您选择。 HTML是 我想调用字符串“setBank(11,0,1)”的无线电点击。 我如何能? 所有无线电名称都相同,但onclick()参数不同。 在JavaScript中有人这样做了一些代码在这里,但我如何在c#中这样做 我尝试这个但从不工作: if (webBrowser1.DocumentText.IndexOf(“setBank(11,0,1)”, StringComparison.InvariantCultureIgnoreCase) > 1) { webBrowser1.Document.GetElementById(“gatewayIDV”).InvokeMember(“click”); } JavaScript : $(“td.cont”).each(function(index) { var $this = $(this); var gonext = true; if($this.html().search(searchStr) != -1) { $(document).BookingEngine(“setAutomationRunningStatus”, !tabData.automationRunning); console.log(index+”:”+$this.html()+”:”); $this.children(“input[name=’gatewayIDV’]”).click(); gonext = false; } return gonext; });

C#reflection – 加载程序集并调用方法(如果存在)

我想加载一个程序集(它的名称存储在一个字符串中),使用reflection来检查它是否有一个名为“CustomType MyMethod(byte [] a,int b)”的方法并调用它或者抛出exception。 我想我应该做这样的事情,但如果有人可以就如何做到这一点提出相同的建议,我将不胜感激: Assembly asm = Assembly.Load(“myAssembly”); /* 1. does it matter if write myAssembly or myAssembly.dll? */ Type t = asm.GetType(“myAssembly.ClassName”); // specify parameters byte[] a = GetParamA(); int b = GetParamB(); object[] params = new object[2]; params[0] = a; params[1] = b; /* 2. invoke method MyMethod() which returns object […]