check to see if the website is up and running from powershell -


i'am trying login web site , see it's , running, below powershell code , error. please let me know doing wrong.

$ie = new-object -comobject "internetexplorer.application"  $ie.visible = $true  $ie.navigate("https://www.mysite.net/websuite/index.do");   while ($ie.busy -eq $true){start-sleep -milliseconds 20000};    $doc = $ie.document   $loginname = $doc.getelementsbyname("abcdef")   $loginname.value = "xxxxxx"   $txtpassword = $doc.getelementsbyname("123456")  $txtpassword = "xx_xxxxxx"   $btnlogin = $doc.getelementsbyname("cmdlogin") 

..and error i'am getting @ value property below

property 'value' cannot found on object; make sure exists , settable. @ e:\xxxx\yyy_yy\test.ps1:12 char:12 + $loginname.v <<<< alue = "xxxxxxx"

hello,

i tried writing below simple requirement of msdn article, have login site login page asking userid , password. need capture success return page , email group saying website , running else it's down, 1 more thing add need run every halfhour, appreciated. below code , errors , errors i'am facing

code

$ie = new-object -com "internetexplorer.application"  $ie.navigate("https://www.mysite.net/websuite/index.do")  $doc = $ie.document  $tb1 = $doc.getelementbyid("textbox1")  $tb2 = $doc.getelementbyid("textbox2")  $btn = $doc.getelementbyid("button1")  $tb1.value = "xxxxxx"  $tb2.value = "xxxx"  $btn.click() 

errors

you cannot call method on null-valued expression. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:7 char:27 + $tb1 = $doc.getelementbyid <<<< ("textbox1") + categoryinfo : invalidoperation: (getelementbyid:string) [], ru ntimeexception + fullyqualifiederrorid : invokemethodonnull

you cannot call method on null-valued expression. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:9 char:27 + $tb2 = $doc.getelementbyid <<<< ("textbox2") + categoryinfo : invalidoperation: (getelementbyid:string) [], ru ntimeexception + fullyqualifiederrorid : invokemethodonnull

you cannot call method on null-valued expression. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:11 char:27 + $btn = $doc.getelementbyid <<<< ("button1") + categoryinfo : invalidoperation: (getelementbyid:string) [], ru ntimeexception + fullyqualifiederrorid : invokemethodonnull

property 'value' cannot found on object; make sure exists , set table. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:13 char:6 + $tb1. <<<< value = "xxxxxx" + categoryinfo : invalidoperation: (value:string) [], runtimeexce ption + fullyqualifiederrorid : propertynotfound

property 'value' cannot found on object; make sure exists , set table. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:15 char:6 + $tb2. <<<< value = "xxxxxx" + categoryinfo : invalidoperation: (value:string) [], runtimeexce ption + fullyqualifiederrorid : propertynotfound

you cannot call method on null-valued expression. @ c:\documents , settings\k082504\myscripts\cmm_login.ps1:17 char:11 + $btn.click <<<< () + categoryinfo : invalidoperation: (click:string) [], runtimeexce

i think it's because example code uses getelementbyid (singular) whereas in code using getelementsbyname (plural). if method did exist called return collection of items , therefore not have value property. mean have 2 or more elements same name don't think allowed.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -