Open johannajaimes opened 6 years ago
This line of code is supposed to look in the web page and locate the search box called menuQuery.
Apparently when it uses getElementsByName to find that, it is failing to find it, so the value of the parenthetic expression is null. Then it tries to continue, and it uses that null and then the error comes.
input name="menuQuery" id="menuQuery" onfocus="if(this.value=='Buscar') this.value='';" onblur="if(this.value=='') this.value='Buscar';" type="text" value="Buscar"
$ie is nice $ie.document is nice $ie.document.getElementById("menuQuery") is nice $ie.document.getElementById("menuQuery").value IS NOT NICE! The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:23 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
OK, we solved one problem and now have a new one. I believe this web page may help us: https://stackoverflow.com/questions/28581791/property-value-cannot-be-found-on-this-object-in-powershell#28582193
The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:22 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
At line:11 char:40
document.querySelectorAll : The term 'document.querySelectorAll' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:9 char:1
+ CategoryInfo : ObjectNotFound: (document.querySelectorAll:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You cannot call a method on a null-valued expression. At line:10 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:11 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression. At line:10 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression. At line:11 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Method invocation failed because [System.DBNull] does not contain a method named 'click'. At line:8 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:9 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
<!DOCTYPE html>
Method invocation failed because [System.DBNull] does not contain a method named 'click'. At line:16 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:18 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
$ie is nice $ie.Document is nice $ie.Document.getElementById("menuQuery") is nice $ie.Document.getElementById("menuQuery").value IS NOT NICE!
Method invocation failed because [System.DBNull] does not contain a method named 'click'. At line:16 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:18 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
$ie is nice $ie.Document is nice $ie.Document.getElementById("menuQuery") is nice $ie.Document.getElementById("menuQuery").value IS NOT NICE! The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:18 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
$ie is nice $ie.Document is nice $ie.Document.getElementById("menuQuery") is nice $ie.Document.getElementById("menuQuery").value IS NOT NICE! The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:26 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
OK, maybe value does not exist because of jquery.
https://stackoverflow.com/questions/4088467/get-the-value-in-an-input-text-box#15903284
$ie is nice $ie.Document is nice $ie.Document.getElementById("menuQuery") is nice $ie.Document.getElementById("menuQuery").value IS NOT NICE! Method invocation failed because [System.DBNull] does not contain a method named 'val'. At line:19 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
jQuery exists? False Could not complete the operation due to error 80020101. At line:41 char:5
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
false
OK, the first thing to solve is:
jQuery exists? False
It seems like the web page has jQuery. The source for the web page is here:
https://gist.github.com/fragamus/83fee3f6408991284d21969005d6f862
I used this powershell code and modified it a little bit:
https://gist.github.com/omidkrad/fbb4bfb3b1f5b83c9898#file-execjavascript-ps1
Now it hangs.
jQuery exists? False Could not complete the operation due to error 80020101. At line:41 char:5
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
false
OK, so the comment in the javascript is causing this error because IE doesn't like the // style comments.
OK, now we are hanging on this line of code:
do { Start-Sleep -m 1000 } while ( $ie.ReadyState -ne 4 )
You cannot call a method on a null-valued expression. At line:7 char:1