【发布时间】:2018-01-05 09:03:53
【问题描述】:
我需要有关在此类按钮中调用方法的帮助。 网站上的 HTML 代码如下所示:
<div class="login-item bottom">
<span class="pwd-link ng-binding ng-hide" ng-click="forgetPwd()" ng-show="oCap.bSptGuidImport || oCap.bSptQAReset" ng-bind="oLan.forgetPwd">Mot de passe oublié ?</span>
<button class="btn btn-primary login-btn" type="button" ng-click="login()"><label class="ng-binding" ng-bind="oLan.login">Se connecter</label></button>
</div>
我使用 powershell 尝试了下面的代码,但它不适用于按钮
$xe = New-Object -Com "InternetExplorer.Application"
$xe.Visible = $true
$IURL = 'http://example.com/doc/page/login.asp'
$xe.Navigate($IURL)
while ($xe.Busy -eq $true) {
Start-Sleep -Milliseconds 1000;
}
# It's OK for these ID's
$xe.Document.IHTMLDocument3_getElementByID('username').Value = 'myloginadmin'
$xe.Document.IHTMLDocument3_getElementByID('password').Value = 'mypassword'
# invoke click button ?
$xe.Document.IHTMLDocument3_getElementsByTagName('button').Click()
我有这个错误信息:
Échec lors de l'appel de la méthode, car [System.__ComObject] ne contient pas de méthode nommée «点击»。 Au caractère Ligne:1 : 1 + $xe.Document.IHTMLDocument3_getElementsByTagName('button').Click() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (click:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound有什么想法吗?
【问题讨论】:
-
请使用翻译的错误信息,而不是本地化的错误信息。世界上并不是每个人都会说法语。