Browse Source

修改续费复选框不能选中的问题

zhaojh 5 years ago
parent
commit
cb3041afe4
1 changed files with 4 additions and 2 deletions
  1. 4 2
      abuyun_renew.py

+ 4 - 2
abuyun_renew.py

@@ -37,7 +37,8 @@ def recharge(is_launch_spider=False):
         element = WebDriverWait(browser, timeout, time_interval).until(EC.element_to_be_clickable((By.XPATH, element_xpath)))
         element.click()
         # 选中要续费的代理渠道
-        checkbox_xpath = r'//tbody/tr/td/div[1]/label/span'
+        # checkbox_xpath = r'//tbody/tr/td/div[1]/label/span'
+        checkbox_xpath = r'/html/body/div[3]/section/div/div/div[2]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr/td[1]/div/label/span'
         # WebDriverWait(browser, timeout, 1).until(EC.presence_of_element_located((By.XPATH, checkbox_xpath)))
         checkbox = WebDriverWait(browser, timeout, time_interval).until(EC.element_to_be_clickable((By.XPATH, checkbox_xpath)))
         checkbox.click()
@@ -45,7 +46,8 @@ def recharge(is_launch_spider=False):
         # 点击续费按钮
         try:
             WebDriverWait(browser, timeout, time_interval).until(
-                lambda x: x.find_element_by_xpath(r'//tbody/tr/td/div[1]/label/input[@type="checkbox"]').is_selected())
+                # lambda x: x.find_element_by_xpath(r'//tbody/tr/td/div[1]/label/input[@type="checkbox"]').is_selected())
+                lambda x: x.find_element_by_xpath(r'/html/body/div[3]/section/div/div/div[2]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr/td[1]/div/label/input[@type="checkbox"]').is_selected())
         except TimeoutException:
             email_util.send_email('Abuyun renew timeout', traceback.format_exc())
         except: