1. http_post with data in body

I want to drive Chrome via chromedriver (or Firefox via geckodriver, ...). Thies drivers are part of SeleniumHQ.

To do this, I need to add "Content-type: application/json" in the header, "{\"desiredCapabilities\";{})" in the body and post the request to the driver at localhost:9515. How can I do this with http_post?

I tried to do this with WinHTTP (Eu3 Standard library) but I don't know how to fill the body of the request.

Regards

Jean-Marc

new topic     » topic index » view message » categorize

2. Re: http_post with data in body

I found two methods working with curl:

1) put the json part in a file then call

curl -i -H "Accept: application/json" -H "Content-Type: application/json; charset=UTF-8" -X POST -d @data.json http://127.0.0.1:9515/session 

2) Escape quotes in data part

curl -i -H "Accept: application/json" -H "Content-Type: application/json; charset=UTF-8" -X POST -d "{\"desiredCapabilities\": {}}" http://127.0.0.1:9515/session 

When run from within Euphoria there will be many more escape chars. As this runs with curl, it should also work with libcurl and probably also with WinHTTP (at least second solution).

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu