Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- header_value_list = ["27.101.101.1", "186.192.18.98", "210.242.154.60"]
- for header_vaule in header_value_list:
- self.reinstantiate_phantom('X-Real-IP', header_value)
- self.phantom.get(url_to_site)
- self.phantom.save_screenshot('C:\\test.png') #View screenshot and it only shows the first icon in the loop
- def reinstantiate_phantom(self, custom_header_name=None, custom_header_value=None):
- if self.phantom is not None:
- self.phantom.get('javascript:localStorage.clear();')
- self.phantom.delete_all_cookies()
- self.phantom.close()
- self.phantom.quit()
- self.phantom = None
- service = ['--ignore-ssl-errors=true', '--disk-cache=false']
- dcaps = {'handlesAlerts': True, 'javascriptEnabled': True}
- dcaps['phantomjs.page.settings.userAgent'] = (
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53 "
- "(KHTML, like Gecko) Chrome/15.0.87")
- dcaps['phantomjs.page.settings.clearMemoryCaches'] = True
- if custom_header_name is not None and custom_header_value is not None:
- dcaps['phantomjs.page.customHeaders.{0}'.format(custom_header_name)]=custom_header_value
- self.phantom = webdriver.PhantomJS(executable_path=self.config.settings['phantom_js_dir'], desired_capabilities=dcaps, service_args=service)
Add Comment
Please, Sign In to add comment