Skip to content

Scrolling to load lazy content: javascript execute not allowed everywhere #5

Description

@Sebisnow

INFO in downloader [/home/ubuntu/StampTheWeb/app/main/downloader.py:213]:

Downloaded url, start scrolling.


ERROR in downloader [/home/ubuntu/StampTheWeb/app/main/downloader.py:594]:

Internal System Error: Can't convert 'tuple' object to str implicitly("Can't convert 'tuple' object to str implicitly",)

Traceback (most recent call last):
File "/home/ubuntu/StampTheWeb/app/main/downloader.py", line 654, in save_render_zip_submit
create_png_from_url(url, sha256)
File "/home/ubuntu/StampTheWeb/app/main/downloader.py", line 214, in create_png_from_url
d_thread.DownloadThread.scroll(phantom)
File "/home/ubuntu/StampTheWeb/app/main/download_thread.py", line 412, in scroll
last_height = phantom.execute_script("return document.body.scrollHeight")
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: {"errorMessage":"Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'sha256-dOEkAci/oPxf5KnvZSDGW6/1gs5qvj7uG++2KYd+qd4='".\n","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"112","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:42911","User-Agent":"Python-urllib/3.5"},"httpVersion":"1.1","method":"POST","post":"{"sessionId": "885ee7e0-8bc8-11e6-966d-15b4ebe12c58", "script": "return document.body.scrollHeight", "args": []}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","queryKey":{},"chunks":["execute"]},"urlOriginal":"/session/885ee7e0-8bc8-11e6-966d-15b4ebe12c58/execute"}}
Screenshot: available via screen

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/StampTheWeb/app/main/downloader.py", line 587, in get_url_history
originstamp_result = save_render_zip_submit(html_text, sha256, url, title)
File "/home/ubuntu/StampTheWeb/app/main/downloader.py", line 670, in save_render_zip_submit
'\n Originstamp Result was: ' + str(originstamp_result.status_code), 'error')
TypeError: Can't convert 'tuple' object to str implicitly

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions