selenium获取缓存数据,


爬虫呢有时候数据方便有时候登入获得cookies,以及获取他存缓存中的数据

一.获取缓存中的数据其实很简单js注入就好了

localStorage_1 = driver.execute_script("return window.localStorage.getItem('key')")

#很多人说我执行了怎么没有获得呢
#那你缓存所在的url不对,你要跳转到他对应的url再获取
driver.get("缓存所在的url")
localStorage_1 = driver.execute_script("return window.localStorage.getItem('key')")

相关内容

    暂无相关文章

评论关闭