For account number
input id="txtNumber" type="tel" maxlength="9" placeholder="Enter your 9 digit Account No."
button id="btnSubmit"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hi
I wish to create a Powershell script to automate a download file from a URL. The challenge is that the website takes a parameter as input as Account number and then it gives the file download link. Everyday there is a new file it creates with file name as date and give download link. When i try to inspect the download link, it says javascript.
Please help as this is something new to me in powershell to try for a URL based automation.
For account number
input id="txtNumber" type="tel" maxlength="9" placeholder="Enter your 9 digit Account No."
button id="btnSubmit"
Hi I tried your way as below but get error for the same.
You cannot call a method on a null-valued expression.
At E:\testbrowse.ps1:6 char:1
The property 'value' cannot be found on this object. Verify that the property exists and can be set.
At E:\testbrowse.ps1:7 char:1
Exception from HRESULT: 0x800A01B6
At E:\testbrowse.ps1:9 char:1
You cannot call a method on a null-valued expression.
At E:\testbrowse.ps1:10 char:1
Hello @Sundaresan Chandrakanth ,
This may be more complicated than it seems.
First you would need to find the field, inspecting the page with F12 and finding the <Input> line and the -ID tag (for example -ID "Account Number", or similar) and the Button ID by inspecting the element as well.
Then you can use the script to navigate there
$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true # To Make it visible
$AccountNumber="12345678" # defines the Account variable
$ie.Navigate("https://<URL>")
$accountnamefield = $ie.document.getElementByID('<the Input ID tag>') #Gets the element by ID
$accountnamefield.value = $AccountNumber #sets the variable
$Link = $ie.document.getElementByID('<Continue Button tag ID>')
$Link.click() # this will continue to the Link generated
Then using the Invoke-Webrequest you should be able to get the link generated.
Hope this helps in your case,
Best regards,
--------------------------------------------------------------------------------------------------
--If the the reply is helpful, please Upvote and Accept as answer--
maybe this helps to get started:
$account = "abaumgarten42"
$url = 'https://github.com/'
$uri = "$url$account"
Invoke-WebRequest -URI $uri
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten