HTML button click, stop window from opening

Welcome Forums General PowerShell Q&A HTML button click, stop window from opening

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

 
Participant
3 months, 2 weeks ago.

  • Author
    Posts
  • #110669

    Participant
    Points: 64
    Rank: Member

    I have a PowerShell script that clicks a button.

    $nextbtn = $fileUploadPage.ParsedHtml.getElementById("btnGetFile")
    $nextbtn.click()

    But it opens up an Internet Explorer window. Is there a way to stop this, and have the button clicked with in PowerShell?

  • #110671

    Participant
    Points: 324
    Helping Hand
    Rank: Contributor

    When you click the button in a browser, is it opening the window? You are finding the button through DOM and clicking the button just like you would in the browser initiating the onClick code, so the assumption would be this would happen in a browser as well. The onClick code is most likely launching the secondary window doing a re-direction or opening a new tab.

    • #110672

      Participant
      Points: 64
      Rank: Member

      No, when I click the button on the browser, it does not open a new Window.  It just goes to the next page.

  • #110680

    Participant
    Points: 324
    Helping Hand
    Rank: Contributor

    That onClick code is still sending you to a page, so it's opening a browser to send you there. Get the page that is being opened and just open that directly rather than doing the button click.

  • #110684

    Participant
    Points: 64
    Rank: Member

    I'm going directly to the URL from IE, and it's working.  Thanks.

The topic ‘HTML button click, stop window from opening’ is closed to new replies.