Web shop check with powershell

This topic contains 5 replies, has 5 voices, and was last updated by  Oliver Adams 4 years, 3 months ago.

  • Author
  • #13813

    Oliver Adams

    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.

  • #13816

    Robert Westerlund

    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).

  • #13889

    Don Jones

    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.

  • #13907


    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/

  • #13908

    Tore Groneng


    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


  • #13924

    Oliver Adams

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

You must be logged in to reply to this topic.