Selenium滚动条操作

import time
from selenium import webdriver
from selenium.webdriver.common import desired_capabilities
from selenium.webdriver.common.keys import Keys

driver = webdriver.PhantomJS()
driver.get("https://play.google.com/store/apps/details?id=com.google.android.youtube&showAllReviews=true")
#将进度条拖拽到底
js="document.body.scrollTop=1000"
driver.execute_script(js)
str_html = driver.page_source
print(str_html)

代码部分很简单,但是报了一个错误

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 'unsafe-inline' https: http:\".\n","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Content-Length":"107","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:15332","User-Agent":"selenium/3.141.0 (python windows)"},"httpVersion":"1.1","method":"POST","post":"{\"script\": \"document.body.scrollTop=1000\", \"args\": [], \"sessionId\": \"b77b9220-0e67-11e9-becc-c1e7b64fbd30\"}","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/b77b9220-0e67-11e9-becc-c1e7b64fbd30/execute"}}
Screenshot: available via screen

 

请问怎么解决?

你可能感兴趣的:(Selenium滚动条操作)