From 66822bdfce3fe9c9e25309f362c31a8c2bd1c0d0 Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Wed, 27 Sep 2023 10:01:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8selenium=E6=8A=93?= =?UTF-8?q?=E5=8F=96=E6=96=87=E7=AB=A0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/zhibo8/plugins/TouTiao.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/zhibo8/plugins/TouTiao.py b/src/plugins/zhibo8/plugins/TouTiao.py index c4148ce..256c6bd 100644 --- a/src/plugins/zhibo8/plugins/TouTiao.py +++ b/src/plugins/zhibo8/plugins/TouTiao.py @@ -74,6 +74,7 @@ def getWenzhangInfo(): chrome_option.add_argument('--no-sandbox') # 解决DevToolsActivePort文件不存在的报错 chrome_option.add_argument('--disable-gpu') # 谷歌文档提到需要加上这个属性来规避bug chrome_option.add_argument('--hide-scrollbars') # 隐藏滚动条, 应对一些特殊页面 + chrome_option.add_experimental_option('excludeSwitches', ['enable-automation']) chrome_option.add_argument('--headless') browser = Chrome(executable_path=driver_path, options=chrome_option) @@ -103,8 +104,9 @@ def getWenzhangInfo(): url = data["url"] if url: # 请求文章正文内容 - wenzhangGet = browser.get(url) - print(wenzhangGet.text) + browser.get(url) + element = browser.find_element(by='XPATH', value="//article") + print(element) # author = None # if data.find("太能喵")>0: # weitoutiaoMap["太能喵"] = weitoutiaoMap["太能喵"]+1