modified: app/amazon/__pycache__/approve.cpython-39.pyc
modified: app/amazon/__pycache__/del_brand.cpython-39.pyc modified: app/amazon/__pycache__/main.cpython-39.pyc modified: app/amazon/__pycache__/match_action.cpython-39.pyc modified: app/amazon/__pycache__/tool.cpython-39.pyc modified: app/amazon/approve.py modified: app/amazon/del_brand.py modified: app/amazon/main.py modified: app/amazon/match_action.py modified: app/amazon/tool.py modified: app/assets/delete-brand.js modified: app/new_web_source/delete-brand.html
This commit is contained in:
@@ -489,7 +489,9 @@ class AmamzonBase(ZiniaoDriver):
|
||||
处理流程:
|
||||
|
||||
"""
|
||||
need_login_ele = self.tab.eles('xpath://h1[@class="a-spacing-small"]',timeout=5)
|
||||
time.sleep(3) # 等待页面可能的登录元素加载,避免跳转等等
|
||||
self.tab.wait.doc_loaded(timeout=30, raise_err=False)
|
||||
need_login_ele = self.tab.eles('xpath://h1[@class="a-spacing-small"]|//span[contains(text(),"登录")]',timeout=5)
|
||||
if len(need_login_ele) >0:
|
||||
print("检测到需要登录元素")
|
||||
return True
|
||||
@@ -497,13 +499,15 @@ class AmamzonBase(ZiniaoDriver):
|
||||
|
||||
def login(self,password,username=""):
|
||||
try:
|
||||
pwd_input = self.tab.ele('xpath://input[@type="password"]',timeout=10)
|
||||
pwd_input.input(password)
|
||||
submit_btn = self.tab.ele('xpath://input[@id="signInSubmit"]',timeout=10)
|
||||
submit_btn.click()
|
||||
pwd_input = self.tab.eles('xpath://input[@type="password"]',timeout=10)
|
||||
if len(pwd_input) > 0:
|
||||
pwd_input[0].input(password)
|
||||
submit_btn = self.tab.eles('xpath://input[@id="signInSubmit"]',timeout=10)
|
||||
if len(submit_btn) > 0:
|
||||
submit_btn[0].click()
|
||||
self.tab.wait.doc_loaded()
|
||||
|
||||
opt_code_input = self.tab.ele('xpath://input[@name="otpCode"]',timeout=10)
|
||||
opt_code_input = self.tab.ele('xpath://input[@name="otpCode"]',timeout=60)
|
||||
opt_code_input.wait.displayed(timeout=10,raise_err=False)
|
||||
for _ in range(30):
|
||||
if opt_code_input.value is not None and opt_code_input.value.strip() != "":
|
||||
@@ -512,6 +516,9 @@ class AmamzonBase(ZiniaoDriver):
|
||||
submit_btn.click()
|
||||
self.tab.wait.doc_loaded()
|
||||
return True
|
||||
time.sleep(1)
|
||||
submit_btn = self.tab.ele('xpath://input[@id="auth-signin-button"]',timeout=10)
|
||||
submit_btn.click()
|
||||
except Exception as e:
|
||||
print("登录过程中发生异常:" + traceback.format_exc())
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user