Click automated on a SharePoint-button (with JavaScript) and answer the messagebox RRS feed

  • Frage

  • Hello,

    My script1 shall automatic click on a button. This button is built with javascript and activates an messagebox. Then the script2 must find the correct button in this box and click that. Because js works asynchronous I have create a backgroundjob. This looks like this:

      # start backgroundjob to click the button in the msg-box
      start-job -filepath ($path + "\popup.ps1")
      # click delete list
      $ie.Document.getElementById("Ribbon.ListForm.Display.Manage.DeleteItem-Medium")|foreach{ $_.Click()}

    This works.

    Now my problem: I have some scripts to find different button (yes, no, ok, ...). I want only on script to find button in msg-boxes. Therefore I have written one script with functions - one function per button. Now my backgroundjob doesn´t work. I´m not sure, whether I call the right function correctly. Currently this looks like this:


      Start-Job -ScriptBlock { ClickBtn } #ClickBtn is the function I need
      $ie.Document.getElementById("ctl00_PlaceHolderMain_ctl09_RptControls_onetidListEdit2")|foreach{ $_.Click() }
      #the script with the functions will be accessed by start of script1 with this: . $funcScriptPath

    Do you recognize my mistake? What can I do, that my scripts work?


    Dienstag, 7. Dezember 2010 08:00