Web shop check with powershell

This topic contains 5 replies, has 5 voices, and was last updated by Profile photo of Oliver Adams Oliver Adams 3 years, 1 month ago.

  • Author
    Posts
  • #13813
    Profile photo of Oliver Adams
    Oliver Adams
    Participant

    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
    Profile photo of Robert Westerlund
    Robert Westerlund
    Participant

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of
    Anonymous

    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
    Profile photo of Tore Groneng
    Tore Groneng
    Participant

    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

  • #13924
    Profile photo of Oliver Adams
    Oliver Adams
    Participant

    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.