自动点击回发标签

时间:2016-07-22 18:26:08

标签: javascript powershell powershell-v3.0

我正在处理打开网址的PowerShell脚本,该网址上有8个标签。当我打开URL时,我想让它自动转到我想要的那个页面上的Tab。

    function getProperty ([System.__ComObject] $obj, [string] $prop)
    {
      [System.__ComObject].InvokeMember($prop,       [System.Reflection.BindingFlags]::GetProperty, $null, $obj, $null)
    }

    $ie = new-object -com "InternetExplorer.Application"
    $ie.visible = $true
    $ie.navigate('http://url.com/number')
    $doc = $ie.Document

    $link = $ie.Document.getElementsByTagName("a") | Where-Object {$_.class -like "class_name" -and $_.href -like "javascript:__doPostBack('Identifier)"}
    $link.click()

出现此错误:

  

您无法在空值表达式上调用方法。

HTML代码

     <td style="width:5px;"></td><td onmouseover="MHover" onmouseout="MUnhover" onkeyup="Mevent" id="Tab_ID"><table class="Tab_Stuff_2" cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="white-space:nowrap;"><a class="class_name" href="javascript:__doPostBack(&#39;Identifier)" style="border-style:none;font-size:1em;">Notes</a></td>
                        </tr>

我不确定一旦打开链接如何拨打我需要的标签。任何指导将不胜感激。

0 个答案:

没有答案