|
@@ -188,7 +188,8 @@ class ShipinhaoSearch:
|
|
|
"showChromedriverLog": True,
|
|
|
# "chromeOptions": {"androidProcess": "com.tencent.mm:appbrand0"},
|
|
|
# "chromeOptions": {"androidProcess": "com.tencent.mm:tools"},
|
|
|
- "chromeOptions": {"androidProcess": "com.tencent.mm"},
|
|
|
+ "chromeOptions": {"androidProcess": "com.tencent.mm:toolsmp"},
|
|
|
+ # "chromeOptions": {"androidProcess": "com.tencent.mm"},
|
|
|
'enableWebviewDetailsCollection': True,
|
|
|
'setWebContentsDebuggingEnabled': True,
|
|
|
'chromedriverExecutable': chromedriverExecutable,
|
|
@@ -243,20 +244,17 @@ class ShipinhaoSearch:
|
|
|
def check_to_webview(cls, log_type, crawler, driver: WebDriver):
|
|
|
webviews = driver.contexts
|
|
|
Common.logger(log_type, crawler).info(f"webviews:{webviews}")
|
|
|
- for webview in webviews:
|
|
|
- if webview == 'NATIVE_APP':
|
|
|
- continue
|
|
|
- driver.switch_to.context(webview)
|
|
|
- time.sleep(1)
|
|
|
- windowHandles = driver.window_handles
|
|
|
- for handle in windowHandles:
|
|
|
- driver.switch_to.window(handle)
|
|
|
- time.sleep(1)
|
|
|
- if len(driver.find_elements(By.XPATH, '//div[@class="unit"]')) != 0:
|
|
|
- Common.logger(log_type, crawler).info('切换 webview 成功')
|
|
|
- return "成功"
|
|
|
- else:
|
|
|
- Common.logger(log_type, crawler).info("切换 webview 失败")
|
|
|
+ driver.switch_to.context(webviews[1])
|
|
|
+ time.sleep(3)
|
|
|
+ windowHandles = driver.window_handles
|
|
|
+ for handle in windowHandles:
|
|
|
+ driver.switch_to.window(handle)
|
|
|
+ time.sleep(3)
|
|
|
+ if driver.find_element(By.XPATH, '//div[@class="unit"]'):
|
|
|
+ Common.logger(log_type, crawler).info('切换 webview 成功')
|
|
|
+ return "成功"
|
|
|
+ else:
|
|
|
+ Common.logger(log_type, crawler).info("切换 webview 失败")
|
|
|
|
|
|
@classmethod
|
|
|
def repeat_out_video_id(cls, log_type, crawler, out_video_id, env):
|
|
@@ -691,7 +689,6 @@ class ShipinhaoSearch:
|
|
|
time.sleep(1)
|
|
|
index = index + len(video_element_temp)
|
|
|
|
|
|
-
|
|
|
@classmethod
|
|
|
def get_search_videos(cls, log_type, crawler, env):
|
|
|
user_list = cls.get_users(log_type, crawler, "wNgi6Z", env)
|