Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Internet Explorer dom在不同的环境中表现不同_Java_Powershell - Fatal编程技术网

Java Internet Explorer dom在不同的环境中表现不同

Java Internet Explorer dom在不同的环境中表现不同,java,powershell,Java,Powershell,我有一个类似于这样的powershell脚本 param( [string]$u, [string]$p ) $username = $u $password = $p cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings" set-itemproperty . ProxyEnable 1 $url = "https://ameriprisestage.service-now.com/" $ie

我有一个类似于这样的powershell脚本

param(
   [string]$u,
   [string]$p
)

$username = $u
$password = $p

cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings"
set-itemproperty . ProxyEnable 1
$url = "https://ameriprisestage.service-now.com/"
$ie = New-Object -com internetexplorer.application;

$ie.visible = $true; 
$ie.navigate($url);
while ($ie.ReadyState -ne 4 -or $ie.Busy)
{
     start-sleep -s 5;
}

 $ieFrame = $ie.Document.getElementById("gsft_main")

 if (($ieFrame -eq $null)) {
    "ieframe is null" | Out-File 'D:\\file.txt' -Append
    exit
 }

 $usrCtrl = $ie.Document.getElementById("user_name")
 if ($usrCtrl -eq $null) {
     " usrCtrl is null at 1" |Out-File 'D:\\file.txt' -Append
 }

 $usrCtrl = $ieFrame.document.getElementById("user_name")
 if ($usrCtrl -eq $null) {
     " usrCtrl is null at 2" |Out-File 'D:\\file.txt' -Append
 }

 $usrCtrl = $ieFrame.contentWindow.document.getElementById("user_name")
 if ($usrCtrl -eq $null) {
     " usrCtrl is null at 3" |Out-File 'D:\\file.txt' -Append
 }

 $usrCtrl = $ieFrame.contentDocument.getElementById("user_name")
 if ($usrCtrl -eq $null) {
      " usrCtrl is null at 4" |Out-File 'D:\\file.txt' -Append
 }

 $usrCtrl = $ieFrame.getElementById("user_name")
 if ($usrCtrl -eq $null) {
    " usrCtrl is null at 5" |Out-File 'D:\\file.txt' -Append
  }

 $usrCtrl.value=$username
 $pass=$ieFrame.contentWindow.Document.getElementById("user_password").value=$password
 $buttn=$ieFrame.contentWindow.document.getElementById("sysverb_login").click()
当我从powershell ISE运行此代码时,我在3和5处得到usrCtrl not null。但是当我从java程序调用相同的代码时,我得到usrCtrl在1、2、3、4和5处为null

我不知道发生了什么事。有人能帮我吗

谢谢 苏吉特改变这个

cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

这是:

D:\\file.txt

D:\\file.txt
D:\file.txt