johannajaimes / powershell

0 stars 0 forks source link

Issues No.1 #1

Open johannajaimes opened 6 years ago

johannajaimes commented 6 years ago

You cannot call a method on a null-valued expression. At line:7 char:1

fragamus commented 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.

johannajaimes commented 6 years ago

input name="menuQuery" id="menuQuery" onfocus="if(this.value=='Buscar') this.value='';" onblur="if(this.value=='') this.value='Buscar';" type="text" value="Buscar"

fragamus commented 6 years ago

This problem is described here:

https://stackoverflow.com/questions/13869518/powershell-ie9-comobject-has-all-null-properties-after-navigating-to-webpage/14996243#14996243

johannajaimes commented 6 years ago

$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

fragamus commented 6 years ago

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

johannajaimes commented 6 years ago

The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:22 char:1

johannajaimes commented 6 years ago

At line:11 char:40

johannajaimes commented 6 years ago

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

You cannot call a method on a null-valued expression. At line:10 char:1

The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:11 char:1

johannajaimes commented 6 years ago

You cannot call a method on a null-valued expression. At line:10 char:1

You cannot call a method on a null-valued expression. At line:11 char:1

johannajaimes commented 6 years ago

Method invocation failed because [System.DBNull] does not contain a method named 'click'. At line:8 char:1

The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:9 char:1

johannajaimes commented 6 years ago

<!DOCTYPE html>

Bizagi
johannajaimes commented 6 years ago

Method invocation failed because [System.DBNull] does not contain a method named 'click'. At line:16 char:1

The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:18 char:1

johannajaimes commented 6 years ago

$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

The property 'value' cannot be found on this object. Verify that the property exists and can be set. At line:18 char:1

johannajaimes commented 6 years ago

http://lmnapp75/BPMDDILP/

johannajaimes commented 6 years ago

$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

johannajaimes commented 6 years ago

$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

fragamus commented 6 years ago

OK, maybe value does not exist because of jquery.

https://stackoverflow.com/questions/4088467/get-the-value-in-an-input-text-box#15903284

johannajaimes commented 6 years ago

$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

johannajaimes commented 6 years ago

jQuery exists? False Could not complete the operation due to error 80020101. At line:41 char:5

false

fragamus commented 6 years ago

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

fragamus commented 6 years ago

Now it hangs.

johannajaimes commented 6 years ago

jQuery exists? False Could not complete the operation due to error 80020101. At line:41 char:5

false

fragamus commented 6 years ago

OK, so the comment in the javascript is causing this error because IE doesn't like the // style comments.

fragamus commented 6 years ago

OK, now we are hanging on this line of code:

do { Start-Sleep -m 1000 } while ( $ie.ReadyState -ne 4 )

fragamus commented 6 years ago

This might help:

https://stackoverflow.com/questions/22510779/can-powershell-wait-until-ie-is-dom-ready#22623348