Note that there are some explanatory texts on larger screens.

plurals
  1. POC# How-to send ENTER from program?
    primarykey
    data
    text
    <p>i am beginer and i write this code and can't send ENTER click from webbrowser component on C#:</p> <pre><code>private void start_submit_Click(object sender, EventArgs e) { XmlDocument xdoc = new XmlDocument(); xdoc.Load("settings.xml"); foreach (System.Xml.XmlNode node in xdoc.SelectNodes("//site")) { foreach (System.Xml.XmlNode child in node) { if (child.Attributes["todo"].Value.ToString() == "navigate") { navigate(url_string); } else if (child.Attributes["todo"].Value.ToString() == "checkbox") { HtmlElementCollection es = webBrowser1.Document.GetElementsByTagName("input"); HtmlElement ele0 = es[1]; ele0.SetAttribute("checked", "true"); } else if (child.Attributes["todo"].Value.ToString() == "pressbutton") { HtmlElementCollection es = webBrowser1.Document.GetElementsByTagName("input"); if (es != null &amp;&amp; es.Count != 0) { HtmlElement ele = es[5]; ele.ScrollIntoView(true); ele.Focus(); SendKeys.Send("{ENTER}"); } } else if (child.Attributes["todo"].Value.ToString() == "wait") { MessageBox.Show("waiting..."); } } } } </code></pre> <p>and settings.xml file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;data&gt; &lt;site num="1" name="http://www.clantemplates.com" pr="5"&gt; &lt;step num="1" todo="navigate" value_todo="http://www.clantemplates.com/forums/register.php" value_2_todo="none"&gt;navigating&lt;/step&gt; &lt;step num="2" todo="checkbox" value_todo="true" value_2_todo="8"&gt;checking checkbox&lt;/step&gt; &lt;step num="3" todo="pressbutton" value_todo="enter" value_2_todo="9"&gt;pressing button&lt;/step&gt; &lt;step num="4" todo="wait" value_todo="" value_2_todo=""&gt;waiting for other click&lt;/step&gt; &lt;/site&gt; &lt;/data&gt; </code></pre> <p>without this piece ENTER sends succesfully</p> <pre><code>else if (child.Attributes["todo"].Value.ToString() == "wait") { MessageBox.Show("waiting..."); } </code></pre> <p>with piece - no</p> <p>how to solve?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload