Note that there are some explanatory texts on larger screens.

plurals
  1. PODoing an HTTP POST in Selenium IDE
    primarykey
    data
    text
    <p>I would like to do a single HTTPS POST to a server using Selenium IDE with an XML payload. The service I'm interacting with doesn't support HTTPS GETs or I would do it that way. (Doing an HTTPS GET is really easy as the whole URL goes into a Selenium <em>open</em> command.) I know there are other ways to do HTTP POSTs such as with curl, but my web testing is currently done in Selenium IDE and I don't want to have to worry about two or three different tools to do my testing.</p> <p>I looked into <a href="https://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit">POST submission by Javascript</a> and modified the code I found there. I put it in as a storeEval command in Selenium IDE. The final version of the code is below:</p> <pre><code>var method = method || "post"; var path = "https://service.url.srv/"; var post = "&lt;xml&gt;payload&lt;/xml&gt;"; var form = document.createElement("form"); form.setAttribute("method", method); form.setAttribute("action", path); var hiddenField = document.createElement("input"); hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("name", ""); hiddenField.setAttribute("value", post); form.appendChild(hiddenField); form.submit(); </code></pre> <p>When I ran a slightly modified version of the example code, I got a message in the Selenium IDE log saying that "document.body is undefined". I tried removing all references to document.body, hoping that a simple form object by itself would be enough. It wasn't. I got "form.submit is not a function". Perhaps there is some Javascript mojo that will work.</p> <p>I haven't found any references on Google or StackOverflow where someone is trying to do a HTTP POST in Selenium IDE. I'm willing to write an extension to Selenium if doing a POST is even possible.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload