我试图导航到网页并使用powershell从HTML中提取单个值。我可以正常登录,但是一旦导航到所需页面,对象html将为空。
有什么想法吗?这可能是ie问题吗?
谢谢
$ieObject = New-Object -com 'InternetExplorer.Application'
$ieObject.Visible = $true
$ieObject.Navigate('https://ocvrli.mydomain.au/login')
Start-Sleep -s 5
($ieObject.Document.getElementsByName("username") |select -first 1).value = $User;
($ieObject.Document.getElementsByName("password") |select -first 1).value = $pword;
($ieObject.Document.getElementsByName("authMethod") |select -first 1).value = "Active Directory";
Start-Sleep -s 1
($ieObject.Document.getElementById("login-button")).click()
Start-Sleep -s 2
$ieObject.Navigate('https://ocvrli.mydomain.au/contentpack?contentPackId=com.vmware.nsx-v')
Start-Sleep -s 10
$nsx_ver = ($ieObject.Document.body) #This is empty