Welcome Forums General PowerShell Q&A Missing or null object

Viewing 2 reply threads
  • Author
    • #173578
      Topics: 1
      Replies: 1
      Points: 18
      Rank: Member


      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: 1158
      Points: 4,045
      Helping Hand
      Rank: Community Hero

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

    • #173602
      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 ?

Viewing 2 reply threads
  • The topic ‘Missing or null object’ is closed to new replies.