|
@@ -243,14 +243,13 @@ 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:
|
|
|
driver.switch_to.context(webviews[1])
|
|
|
- # driver.switch_to.context('WEBVIEW_com.tencent.mm:tools')
|
|
|
time.sleep(1)
|
|
|
windowHandles = driver.window_handles
|
|
|
for handle in windowHandles:
|
|
|
driver.switch_to.window(handle)
|
|
|
- if driver.find_element(By.XPATH, '//div[@class="unit"]'):
|
|
|
+ time.sleep(1)
|
|
|
+ if len(driver.find_elements(By.XPATH, '//div[@class="unit"]')) != 0:
|
|
|
Common.logger(log_type, crawler).info('切换 webview 成功')
|
|
|
return "成功"
|
|
|
else:
|