Web shop check with powershell

I have been asked by some guys at work if it is possible to log in to a web shop that one of our customers runs. Then purchase something for a very small amount check for success and then exit. Is this type of action possible in powershell? It is not an area I have looked into before.

It depends on what you want to test. If you want to test that the HTTP POST requests are handled correctly you could just use the Invoke-WebRequest cmdlet (or WebClient or HttpWebRequest classes, if you are using an older PowerShell version) to make the necessary POST requests. If you want to test that the web page works in a browser, you need to automate the browser (which you could do either by using browser COM objects or some Windows automation API).

Yeah, how you do this depends a LOT on how the website physically works. For example, if it’s built entirely around post-backs (each click submits a request to the server), that’s not impossible to automate using Invoke-WebRequest. On the other hand, if it uses any Javascript whatsoever, then you have to automate a browser, because the browser has to run the Javascript. PowerShell’s not an ideal tool for this either way - there are definitely better ones out there for this task. Visual Studio’s test tools, for example, are designed almost exactly for this.

elaborating on Don’s point if you do have to go down the road of browser automation you may want to check out Selenium. http://docs.seleniumhq.org/

Hi,

Or you could use Microsoft Application Insights in combination with Visual Studio WebTest like Don suggested or with OpsMgr 2012. More info here:

Application Insights

Cheers

Thanks for the great answers guys a lot of options here to investigate, thanks for the help.