Skip to content

Instantly share code, notes, and snippets.

@Milo24s1
Last active November 12, 2019 11:24
Show Gist options
  • Save Milo24s1/cf2b3c357510abf3f1887576d9d7ba62 to your computer and use it in GitHub Desktop.
Save Milo24s1/cf2b3c357510abf3f1887576d9d7ba62 to your computer and use it in GitHub Desktop.
$sJavascript = <<<END_JAVASCRIPT
var callback = arguments[arguments.length-1], // webdriver async script callback
async function getUserInfo(){
var result = await fetch('https://api.github.com/users/milo24s1',{
credentials: "same-origin"}).then(response=>response.json()).then(text => text);
console.log(result);
callback(result);
}
getUserInfo();
END_JAVASCRIPT;
$output=$this->webdriver->executeAsyncScript($sJavascript,array());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment