driver = webdriver.PhantomJS('phantomjs')
driver.command_executor._commands['executePhantomScript'
    ] = 'POST', '/session/$sessionId/phantom/execute'
How to run webpage code with PhantomJS via GhostDriver (selenium)