-
-
Save LeCoupa/9873864 to your computer and use it in GitHub Desktop.
How to fake the HTTP referer with CasperJS --> https://github.com/LeCoupa/awesome-cheatsheets
This file contains 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
# Define Variables + Casper Initialization | |
fakeReferer = 'https://google.com/' | |
targetUrl = 'https://facebook.com/' | |
casper = require('casper').create() | |
# Fake the referer | |
casper.start fakeReferer, -> | |
@echo @getCurrentUrl() | |
casper.then -> | |
@evaluate (targetUrl) -> | |
link = document.createElement 'a' | |
link.setAttribute 'href', targetUrl | |
link.setAttribute 'id', 'myTargetUrl' | |
document.body.appendChild link | |
, targetUrl | |
casper.then -> | |
@click 'a#myTargetUrl' | |
casper.run -> | |
@echo @getCurrentUrl() | |
@exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment