本文整理汇总了C#中System.Windows.Forms.HtmlElement.InvokeMember方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlElement.InvokeMember方法的具体用法?C# HtmlElement.InvokeMember怎么用?C# HtmlElement.InvokeMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.InvokeMember方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Click
public void Click(HtmlElement h)
{
Focus(h);
Over(h);
Down(h);
h.InvokeMember("click");
}
示例2: WebBrowserInvokeMember
private void WebBrowserInvokeMember(HtmlElement h, string action)
{
h.InvokeMember(action);
DateTime dt = DateTime.Now;
WebBrowserReadyState readyState = GetWebBrowserReadyState();
while (readyState != WebBrowserReadyState.Complete /*&& webBrowser1.ReadyState != WebBrowserReadyState.Loaded*/ &&
(DateTime.Now - dt).TotalSeconds < 10)
{
Application.DoEvents();
Thread.Sleep(100);
}
Application.DoEvents();
Thread.Sleep(1000);
}
示例3: vl1f
//Insert values
public void vl1f()
{
hElement1 = webBrowser1.Document.GetElementById(textBoxJSLogin.Text);
hElement1.SetAttribute("value", textBoxBrowserLogin.Text);
hElement2 = webBrowser1.Document.GetElementById(textBoxJSPass.Text);
hElement2.SetAttribute("value", textBoxBrowserPassword.Text);
hElement3 = webBrowser1.Document.GetElementById(textBoxJSForm.Text);
hElement3.InvokeMember(textBoxJSSubmit.Text);
}
示例4: PopulateInputFile
async Task PopulateInputFile(HtmlElement file, String photo)
{
file.Focus();
// delay the execution of SendKey to let the Choose File dialog show up
var sendKeyTask = TaskEx.Delay(500).ContinueWith((_) =>
{
// this gets executed when the dialog is visible
SendKeys.SendWait(photo + "{ENTER}");
}, TaskScheduler.FromCurrentSynchronizationContext());
file.InvokeMember("Click"); // this shows up the dialog
await sendKeyTask;
file.RemoveFocus();
// delay continuation to let the Choose File dialog hide
await TaskEx.Delay(500);
}
示例5: click
public void click(HtmlElement elm)
{
if (elm == null)
return;
elm.InvokeMember("click");
}
示例6: Up
public void Up(HtmlElement h)
{
h.InvokeMember("fireEvent", new object[] { "onkeyup" });
}
示例7: Down
public void Down(HtmlElement h)
{
h.InvokeMember("fireEvent", new object[] { "onkeydown" });
}
示例8: timer1_Tick
private void timer1_Tick(object sender, EventArgs e)
{
switch (step)
{
case 1:
step = 0;
toolStep.Text = "Étape : 1";
hotmailer.webBrowser1.Navigate("http://google.com");
hotmailer.Show();
step = 2;
break;
case 2:
step = 0;
toolStep.Text = "Étape : 2";
identity = hotmailer.webBrowser1.Document.GetElementById("identity");
/*
* Modifications for GAF
*
*/
SendKeys.Send("test");
ClearCookies();
WebBrowserHelper.ClearCache();
break;
if (identity != null)
{
// Entre mot de passe
identity.Focus();
SendKeys.Send("loubna");
if (identity.GetAttribute("value") != "loubna")
{
// La page n'était pas chargée
step = 2;
return;
}
// Entre code de campagne.
campaignCode = hotmailer.webBrowser1.Document.GetElementById("campaignCode");
campaignCode.Focus();
SendKeys.SendWait(codeDeCampagne);
while (campaignCode.GetAttribute("value") != codeDeCampagne)
{
campaignCode.Focus();
// Problème quelconque: on efface l'input et recommence.
while (campaignCode.GetAttribute("value") != "")
{
SendKeys.SendWait("{BACKSPACE}");
}
SendKeys.SendWait(codeDeCampagne);
}
// Clique sur une DIV invisble ayant onclick="next();": simule un "{ENTER}"
pressEnter = hotmailer.webBrowser1.Document.GetElementById("pressEnter");
pressEnter.InvokeMember("click");
step = 3;
}
else
{
step = 2;
}
break;
case 3:
step = 0;
toolStep.Text = "Étape : 3";
// Collecte le compte Yahoo
address = hotmailer.webBrowser1.Document.GetElementById("address");
strAddress = address.GetAttribute("value");
if (strAddress == "")
{
// La page n'était pas chargée
step = 3;
return;
}
// Collecte le mot de passe
password = hotmailer.webBrowser1.Document.GetElementById("password");
strPassword = password.GetAttribute("value");
// Collecte le récipient
recipient = hotmailer.webBrowser1.Document.GetElementById("recipient");
strRecipient = recipient.GetAttribute("value");
//.........这里部分代码省略.........
示例9: Click
public void Click(HtmlElement elem)
{
elem.InvokeMember("click");
}
示例10: ClickNextPage
public bool ClickNextPage(IntPtr hwnd, HtmlElement visitItem)
{
Point p = GetOffset(visitItem);
Size winSize = InitialTabBrowser.Document.Window.Size;
InitialTabBrowser.Document.Window.ScrollTo(winSize.Width / 2, p.Y);
p.Y -= InitialTabBrowser.Document.GetElementsByTagName("HTML")[0].ScrollTop;
p.X += visitItem.OffsetRectangle.Width / 2;
p.Y += visitItem.OffsetRectangle.Height / 2;
InitialTabBrowser.Document.InvokeScript("simulate", new object[] { visitItem.Parent.DomElement, "click" });
//HtmlElement ele = InitialTabBrowser.Document.GetElementFromPoint(p);
ClickOnPointInClient(hwnd, p);
//ClientToScreen(hwnd, ref p);
//Cursor.Position = new Point(p.X, p.Y);
visitItem.InvokeMember("click");
//ClickOnPoint(hwnd, p);
return true;
}
示例11: NavigateToSite
protected void NavigateToSite(HtmlElement oLink, ref WebBrowser oBrowser)
{
CountedWait oCWTimer = new CountedWait(ref oBrowser, 3000);
while (true)
{
try
{
sSiteToNavigate = oLink.GetAttribute("href");
oLink.InvokeMember("click");
if (oCWTimer.Wait(10))
{
bSiteFound = true;
TimedWait oTimedWait = new TimedWait(oRandomizer.Next(10000, 30000));
oTimedWait.Wait();
return;
}
else
{
//System.Console.WriteLine("Proxy timeout, switching to next one.");
wininet.RefreshIEProxySettings();
}
}
catch (UnauthorizedAccessException ex)
{
throw new UnauthorizedAccessException("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception", ex);
}
catch (AccessViolationException ex)
{
throw new AccessViolationException("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception", ex);
}
catch (Exception ex)
{
System.Console.WriteLine("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception, reason: " + ex.Message + ", switching proxy");
wininet.RefreshIEProxySettings();
}
}
}
示例12: GoToNextPage
protected void GoToNextPage(HtmlElement oLink, ref WebBrowser oBrowser)
{
CountedWait oCWTimer = new CountedWait(ref oBrowser, 3000);
while (true)
{
try
{
// Below line added to rise UnauthorizedAccessException in case something went wrong
String sHREF = oLink.GetAttribute("href");
oLink.InvokeMember("click");
if (oCWTimer.Wait(10))
{
TimedWait oTimedWait = new TimedWait(oRandomizer.Next(8000, 14000));
oTimedWait.Wait();
return;
}
else
{
//System.Console.WriteLine("Proxy timeout, switching to next one.");
wininet.RefreshIEProxySettings();
}
}
catch (UnauthorizedAccessException ex)
{
throw new UnauthorizedAccessException("Unauthorized access to HTML properties, aborting operation", ex);
}
catch (AccessViolationException ex)
{
throw new AccessViolationException("Access Violation, aborting operation", ex);
}
catch (Exception ex)
{
System.Console.WriteLine("..::" + this.GetType().Name + "::..GoToNextPage thrown an exception, reason: " + ex.Message + ", switching proxy");
wininet.RefreshIEProxySettings();
}
}
}
示例13: Over
public void Over(HtmlElement h)
{
h.InvokeMember("fireEvent", new object[] { "onmouseover" });
}
示例14: MouseClick
public void MouseClick(HtmlElement h)
{
h.InvokeMember("fireEvent", new object[] { "onmouseclick" });
}
示例15: Move
public void Move(HtmlElement h)
{
h.InvokeMember("fireEvent", new object[] { "onmousemove" });
}