title: powershell: how to click a "submit type" input
body: <p>used powershell to do web ui automation.  came up an exception: invoke method failed, because [System.__ComObject] does not contain “click” method.</p>
  
  <p>can submit type input be clicked?</p>
  
  <p>i used getElementsByTagName getElementsByClassName getElementsByName , does not work.</p>
  
  <p>anyone can help me on this?</p>
  
  <p>powershell code is below:</p>
  
  <pre><code># open the specified web site and commit the key
  $ie = new-object -com "InternetExplorer.Application"
  $ie.navigate("http://gitlab.alibaba-inc.com/keys/new")
  $ie.visible = $true
  while($ie.busy) {sleep 1}
  
  $doc = $ie.document
  
  # commit the button
  $commit = $doc.getElementsByTagName("commit")
  
  if($commit) 
  {$commit.click()}
  </code></pre>
  
  <p>the html source is as below:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang='en'&gt;
  &lt;head&gt;
  &lt;meta charset='utf-8'&gt;
  &lt;title&gt;
  Profile | 
  GitLab
  &lt;/title&gt;
  &lt;link href="/assets/favicon-4b751da746de7855d7eb8123072388ed.ico" rel="shortcut icon"    type="image/vnd.microsoft.icon" /&gt;
  &lt;link href="/assets/application-a9eac7f5b0c3b922de8997ae9ad74ab0.css" media="screen" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="/assets/application-61398d184a36e6ae900134f123d5d649.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;meta content="authenticity_token" name="csrf-param" /&gt;
  &lt;meta content="9SLFk6AwlsN2FoyO8xPY+M1hEbKfqlLTQ4CSDVc4efE=" name="csrf-token" /&gt;
  &lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  window.gon =   {};gon.default_issues_tracker="gitlab";gon.api_version="v3";gon.api_token="xkMg31Ssva322SDF cgxY";gon.gravatar_url="http://www.gravatar.com/avatar/%{hash}?s=% {size}&amp;d=mm";gon.relative_url_root="";
  //]]&gt;
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body class='ui_basic profile' data-page='keys:new'&gt;
  &lt;header class='navbar navbar-static-top navbar-gitlab'&gt;
  &lt;div class='navbar-inner'&gt;
  &lt;div class='container'&gt;
  &lt;div class='app_logo'&gt;
  &lt;span class='separator'&gt;&lt;/span&gt;
  &lt;a href="/" class="home has_bottom_tooltip" title="Dashboard"&gt;&lt;h1&gt;GITLAB&lt;/h1&gt;
  &lt;/a&gt;&lt;span class='separator'&gt;&lt;/span&gt;
  &lt;/div&gt;
  &lt;h1 class='project_name'&gt;Profile&lt;/h1&gt;
  &lt;ul class='nav'&gt;
  &lt;li&gt;
  &lt;a&gt;
  &lt;div class='hide turbolink-spinner'&gt;
  &lt;i class='icon-refresh icon-spin'&gt;&lt;/i&gt;
  Loading...
  &lt;/div&gt;
  &lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
  &lt;div class='search'&gt;
  &lt;form accept-charset="UTF-8" action="/search" class="navbar-form pull-left"  method="get"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8"  type="hidden" value="&amp;#x2713;" /&gt;&lt;/div&gt;
  &lt;input class="search-input" id="search" name="search" placeholder="Search" type="text"   /&gt;
  &lt;input id="group_id" name="group_id" type="hidden" /&gt;
  &lt;input id="repository_ref" name="repository_ref" type="hidden" /&gt;
  
  &lt;div class='search-autocomplete-json hide' data-autocomplete-opts='[{"label":"project:  kelude2","url":"/kelude2"},{"label":"My Profile","url":"/profile"},{"label":"My SSH  Keys","url":"/keys"},{"label":"My Dashboard","url":"/"},{"label":"Admin  Section","url":"/admin"},{"label":"help: API Help","url":"/help/api"},{"label":"help:  Markdown Help","url":"/help/markdown"},{"label":"help: Permissions  Help","url":"/help/permissions"},{"label":"help: Public Access  Help","url":"/help/public_access"},{"label":"help: Rake Tasks  Help","url":"/help/raketasks"},{"label":"help: SSH Keys Help","url":"/help/ssh"}, {"label":"help: System Hooks Help","url":"/help/system_hooks"},{"label":"help: Web Hooks  Help","url":"/help/web_hooks"},{"label":"help: Workflow Help","url":"/help/workflow"}]'&gt;   &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;/div&gt;
  
  &lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/public" class="has_bottom_tooltip" data-original-title="Public area"    title="Public area"&gt;&lt;i class='icon-globe'&gt;&lt;/i&gt;
  &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/s/heyun" class="has_bottom_tooltip" data-original-title="Public area"    title="My snippets"&gt;&lt;i class='icon-paste'&gt;&lt;/i&gt;
  &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/projects/new" class="has_bottom_tooltip" data-original-title="New project"    title="Create New Project"&gt;&lt;i class='icon-plus'&gt;&lt;/i&gt;
  &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/profile" class="has_bottom_tooltip" data-original-title="Your profile"    title="My Profile"&gt;&lt;i class='icon-user'&gt;&lt;/i&gt;
  &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/users/sign_out" class="has_bottom_tooltip" data-method="delete" data-original-title="Logout" rel="nofollow" title="Logout"&gt;&lt;i class='icon-signout'&gt;&lt;/i&gt;  
  &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;a href="/u/heyun" class="profile-pic"&gt;&lt;img alt="F3ea5164088694b48e4980e52d831927? s=26&amp;amp;d=mm" src="http://www.gravatar.com/avatar/f3ea5164088694b48e4980e52d831927? s=26&amp;amp;d=mm" /&gt;
  &lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/header&gt;
  
  &lt;div class='flash-container'&gt;
  &lt;/div&gt;
  
  &lt;nav class='main-nav'&gt;
  &lt;div class='container'&gt;&lt;ul&gt;
  &lt;li class="home"&gt;&lt;a href="/profile" title="Profile"&gt;&lt;i class='icon-home'&gt;&lt;/i&gt;
  &lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="/profile/account"&gt;Account&lt;/a&gt;
  &lt;/li&gt;&lt;li class=""&gt;&lt;a href="/profile/notifications"&gt;Notifications&lt;/a&gt;
  &lt;/li&gt;&lt;li class="active"&gt;&lt;a href="/keys"&gt;SSH Keys
  &lt;span class='count'&gt;1&lt;/span&gt;
  &lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="/profile/design"&gt;Design&lt;/a&gt;
  &lt;/li&gt;&lt;li class=""&gt;&lt;a href="/profile/history"&gt;History&lt;/a&gt;
  &lt;/li&gt;&lt;/ul&gt;
  &lt;/div&gt;
  &lt;/nav&gt;
  &lt;div class='container'&gt;
  &lt;div class='content'&gt;&lt;h3 class='page_title'&gt;Add an SSH Key&lt;/h3&gt;
  &lt;hr&gt;
  &lt;div&gt;
  &lt;form accept-charset="UTF-8" action="/keys" class="new_key" id="new_key" method="post"&gt;   &lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden"   value="&amp;#x2713;" /&gt;&lt;input name="authenticity_token" type="hidden"   value="9SLFk6AwlsN2FoyO8xPY+M1hEbKfqlLTQ4CSDVc4efE=" /&gt;&lt;/div&gt;&lt;div class='clearfix'&gt;
  &lt;label for="key_title"&gt;Title&lt;/label&gt;
  &lt;div class='input'&gt;&lt;input id="key_title" name="key[title]" size="30" type="text" /&gt;   &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class='clearfix'&gt;
  &lt;label for="key_key"&gt;Key&lt;/label&gt;
  &lt;div class='input'&gt;
  &lt;textarea class="xxlarge thin_area" cols="40" id="key_key" name="key[key]" rows="20"&gt;
  &lt;/textarea&gt;
  &lt;p class='hint'&gt;
  Paste your public key here. Read more about how generate it
  &lt;a href="/help/ssh"&gt;here&lt;/a&gt;
  &lt;/p&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class='actions'&gt;
  &lt;input class="btn btn-save" name="commit" type="submit" value="Save" /&gt;
  &lt;a href="/keys" class="btn btn-cancel"&gt;Cancel&lt;/a&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;/div&gt;
  
  &lt;script&gt;
    $('#key_key').on('keyup', function(){
      var title = $('#key_title'),
          val      = $('#key_key').val(),
          key_mail = val.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+|\.[a-zA-Z0-9._-]+)/gi);
  
      if( key_mail &amp;&amp; key_mail.length &gt; 0 &amp;&amp; title.val() == '' ){
        $('#key_title').val( key_mail );
      }
    });
  &lt;/script&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>