Created
December 12, 2019 01:15
-
-
Save andrewnicols/7034a5c1da06eba69401f4c09eb2460b to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
WDURL="http://localhost:9515"; | |
#RESPONSE=`curl -s -d '{"capabilities": {"firstMatch": [{"acceptInsecureCerts": false, "browserName": "chrome"}]}}' "${WDURL}/session"` | |
RESPONSE=`curl -s -d '{"capabilities": {"firstMatch": [{"acceptInsecureCerts": false, "browserName": "chrome", "goog:chromeOptions": {"args": ["-headless"]}}]}}' "${WDURL}/session"` | |
SESSIONID=`echo "${RESPONSE}" | python3 -c "import sys, json; print(json.load(sys.stdin)['value']['sessionId'])"` | |
echo "Setting URL:" | |
curl -d '{"url":"http:\/\/localhost\/date.html"}' "${WDURL}/session/${SESSIONID}/url" | |
echo | |
echo "Getting element ID" | |
ELEMENTID=`curl -s -d '{"using": "css selector", "value": "#dateval"}' "${WDURL}/session/${SESSIONID}/element" | \ | |
python3 -c "import sys, json; print(json.load(sys.stdin)['value']['element-6066-11e4-a52e-4f735466cecf'])"` | |
echo | |
echo "Getting current document.visibilityState" | |
curl -d '{"script": "return document.visibilityState;", "args": []}' "${WDURL}/session/${SESSIONID}/execute/sync" | |
echo | |
echo "Minimizing" | |
curl -d '{}' "${WDURL}/session/${SESSIONID}/window/minimize" | |
echo | |
echo "Getting updated document.visibilityState" | |
curl -d '{"script": "return document.visibilityState;", "args": []}' "${WDURL}/session/${SESSIONID}/execute/sync" | |
echo | |
echo "Deleting window:" | |
curl -X DELETE "${WDURL}/session/${SESSIONID}/window" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment