Missing or null object

Welcome Forums General PowerShell Q&A Missing or null object

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 weeks, 1 day ago.

  • Author
    Posts
  • #173578

    Participant
    Topics: 1
    Replies: 1
    Points: 18
    Rank: Member

    Hello!!

    first at all, Sorry for my bad inglish, im Brazillian.

     

    So... I need create a automated script that creates an IE object and handles the elements in web page...

    $ie = new-object -ComObject "InternetExplorer.Application"

    My problem is: I can create that object in all other pages, i can get elements by Id, Tag, Class, etc ... but, in determined page i can't. Looks like the object after addressing the page "$ie.navigate($page)", that is null or empty.

    give me an error:

    PS C: \ Users \ thalys> $ ie.Document | get-Member
    get-Member: You must specify an object for the Get-Member cmdlet.
    In the line: 1 character: 16
    + $ ie.Document | get-Member
    + ~~~~~~~~~~
        + CategoryInfo: CloseError: (:) [Get-Member], InvalidOperationException
        + FullyQualifiedErrorId: NoObjectInGetMember, Microsoft.PowerShell.Commands.GetMemberCommand
    PS C: \ Users \ thalys> $ ie.Document.getElementById ("abrirModalLogin"). Click
    You cannot call a method on a null value expression.
    In line: 1 character: 1
    + $ ie.Document.getElementById ("abrirModalLogin"). click
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
        + CategoryInfo: InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId: InvokeMethodOnNull

    if need know what that page, ask me.

     

  • #173596

    Senior Moderator
    Topics: 8
    Replies: 1041
    Points: 3,439
    Helping Hand
    Rank: Community Hero

    check if the page is loaded as expected.
    set $ie.visible = $true to open the hidden web browser.

  • #173602

    Participant
    Topics: 1
    Replies: 1
    Points: 18
    Rank: Member

    yes, the page loads and when i give the comand navigate, the cursor loads, (seems to execute the comand), but when write the others commands, give me thats errors in topics... I can catch any log to analyse this object ?
    The page run some Framework, does it impact anything ?

You must be logged in to reply to this topic.