daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Jan 18th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. driver = webdriver.PhantomJS("phantomjs.exe", desired_capabilities = dcap)
  2. webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.page.settings.javascriptEnabled"] = False
  3. webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.takesScreenshot"] = False
  4. webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.page.clearMemoryCash"] = False
  5.    
  6. browserName:phantomjs
  7. version:2.1.1
  8. driverName:ghostdriver
  9. driverVersion:1.2.0
  10. platform:windows-7-32bit
  11. javascriptEnabled:true   # Should be false
  12. takesScreenshot:true     # Should be false
  13.    
  14. phantom_exc_uri='/session/$sessionId/phantom/execute'
  15. driver.command_executor._commands['executePhantomScript'] = ('POST', phantom_exc_uri)
  16. initScript="""            
  17. this.onInitialized=function() {
  18.     var page=this;
  19.    ### disable javascript and screenshots here ###
  20. }
  21. """
  22. driver.execute('executePhantomScript',{'script': initScript, 'args': []})
RAW Paste Data
Top