$ie = new-object -com internetexplorer.application
$ie.visible=$true
$ie.navigate('https://google.co.in')
while($ie.ReadyState -ne 4)
{
Write-Host "dom is loading"
$ie.ReadyState -eq 4
$ie.ReadyState -eq 3
$ie.ReadyState -eq 2
$ie.ReadyState -eq 1
$ie.ReadyState -eq 0
start-sleep -M 100
}
($ie.Document.Document3_getElementsByTagName('a')|where-object{$_.innerText -eq "मराठी"}).click()
答案 0 :(得分:0)
这应该可以帮到你:
1) Set up done in Windows-> Preferences -> Validations
a) Set the checkbox for 'Allow projects to override these preference settings'
b) Set the check box for 'Suspend all validators'
c) Rest all the check boxes are unset especially DTD validator, XML Schema Validator and XML Validator are individually deselected.
2) Build Automatically was deselected and verified, but the same situation occured. For the current set up I have enabled it again.
注意:当你第二次运行脚本时,即因为语言已经改变而无法找到标签
答案 1 :(得分:0)
尝试在运行脚本之前获取管理员权限
在运行脚本之前使用下面的脚本。它将为您提供运行脚本的管理员权限
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;
if ($myWindowsPrincipal.IsInRole($adminRole))
{
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)";
Clear-Host;
}
else {
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
$newProcess.Arguments = "& '" + $script:MyInvocation.MyCommand.Path + "'"
$newProcess.Verb = "runas";
[System.Diagnostics.Process]::Start($newProcess);
Exit;
}