Author Posts

August 31, 2018 at 6:17 pm

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?

August 31, 2018 at 6:54 pm

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.

August 31, 2018 at 6:59 pm

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

August 31, 2018 at 7:21 pm

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.

August 31, 2018 at 7:28 pm

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