Last active
March 13, 2024 16:19
Run Selenium test via curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s_id=`curl -X POST http://127.0.0.1:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName":"firefox","platform":"MAC"}}'|awk -F'"' '{print $6}'` | |
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/url -d '{"url":"http://www.google.com"}' | |
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element -d '{"using":"id","value":"gbqfq"}' | |
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element/0/value -d {"value":["selenium"]} | |
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element -d '{"using":"id","value":"gbqfb"}' | |
curl -X POST http://127.0.0.1:4444/wd/hub/session/$s_id/element/1/click | |
curl -X DELETE http://127.0.0.1:4444/wd/hub/session/$s_id/window |
Thank you!!
We remove the entire session, instead of the window.
s_id=`curl -X POST http://hub:4444/wd/hub/session -d '{"desiredCapabilities": { "browserName": "chrome", "browser": "chrome" }}'| grep "sessionId" | awk -F'"' '{print $4}'`
curl -X POST http://hub:4444/wd/hub/session/$s_id/url -d '{"url":"http://apache/en-int/examples/product"}'
curl -X DELETE http://hub:4444/wd/hub/session/$s_id
how to run s_id in python?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is good man!