Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- driver = webdriver.PhantomJS("phantomjs.exe", desired_capabilities = dcap)
- webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.page.settings.javascriptEnabled"] = False
- webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.takesScreenshot"] = False
- webdriver.DesiredCapabilities.PHANTOMJS["phantomjs.page.clearMemoryCash"] = False
- browserName:phantomjs
- version:2.1.1
- driverName:ghostdriver
- driverVersion:1.2.0
- platform:windows-7-32bit
- javascriptEnabled:true # Should be false
- takesScreenshot:true # Should be false
- phantom_exc_uri='/session/$sessionId/phantom/execute'
- driver.command_executor._commands['executePhantomScript'] = ('POST', phantom_exc_uri)
- initScript="""
- this.onInitialized=function() {
- var page=this;
- ### disable javascript and screenshots here ###
- }
- """
- driver.execute('executePhantomScript',{'script': initScript, 'args': []})
Add Comment
Please, Sign In to add comment