0
powershell ISE를 통해 웹 사이트에 로그인하려고합니다. 웹 페이지가 나타나지만 자격 증명을 입력하지 않습니다.PowerShell을 통해 웹 사이트에 로그인
$username = "DSmith"
$password = "Password123"
$ie = New-Object -com InternetExplorer.Application
$ie.visible=$false
$ie.navigate("https://feedback.camdenccg.nhs.uk/acl_users/credentials_cookie_auth/require_login? came_from=https%3A//feedback.camdenccg.nhs.uk/james-wigg-and-queens-crescent-practices/4ef32a4e/download_responses%3Foverride-query%3DTrue")
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.document.getElementById('__ac_name').value= "$username"
$ie.document.getElementById('__ac_password').value = "$password"
$ie.document.getElementById("loginform").submit()
start-sleep 5
내가 오류는 다음과 같습니다 값을 설정 한 후 클릭을 할 입력 값을 사용하는 태그 이름
The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))
At line:10 char:7
+ while($ie.ReadyState -ne 4) {start-sleep -m 100}
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
You cannot call a method on a null-valued expression.
At line:12 char:1
+ $ie.document.getElementById('__ac_name').value= "$username"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
올바른 ID는 __ac_name입니다. – Filburt
네, 맞습니다. – Djbril
'$ test = $ ie.document.getElementById ("loginform")' 'Get-Variable $ test'는 ID가 'loginform'인 페이지에 객체가 없음을 나타내는'null'을 반환합니다. 그래서 그것을 클릭 할 수 없습니다. 오브젝트 이름을 확인하고 대신 {getNameBeTagName' 또는 getElementsByType ("button") | {$ .Name -eq "loginform"}'을 사용하십시오. – meatspace