소스 검색

经过服务器测试后可用的版本

Shellmiao 4 년 전
부모
커밋
2632d3bc89
4개의 변경된 파일13개의 추가작업 그리고 8개의 파일을 삭제
  1. 5 3
      VerificationCode/mcbbs/SignIn.py
  2. 4 3
      VerificationCode/mcbbs/reply.py
  3. 2 0
      VerificationCode/mcbbs/task.py
  4. 2 2
      VerificationCode/ttshitu.py

+ 5 - 3
VerificationCode/mcbbs/SignIn.py

@@ -17,7 +17,7 @@ def main_sign_in(driver):
 def sign_in_vc(driver):
     image = get_image(driver)
     image = image.convert('RGB')
-    image.save('D:\同步文件\课程文件\文档\mcbbs搞事\AutoTool\VerificationCode\image.jpg')
+    image.save('D:\\同步文件\\课程文件\文档\\mcbbs搞事\\AutoTool\\VerificationCode\\image.jpg')
     img_path = 'D:\同步文件\课程文件\文档\mcbbs搞事\AutoTool\VerificationCode\image.jpg'
     result, rid = base64_api(uname='Shellmiao', pwd='sBif.9MMF8Pa', img=img_path)
     print(result)
@@ -41,7 +41,9 @@ def click_vc_words(driver, locations, rid):
         location[0] = location[0] * 0.5
         location[1] = location[1] * 0.5
         print(location)
-        ActionChains(driver).move_to_element_with_offset(element, location[0], location[1]).click().perform()
+        temp = ActionChains(driver).move_to_element_with_offset(element, location[0], location[1])
+        time.sleep(2)
+        temp.click().perform()
         time.sleep(1)
     time.sleep(1)
     button = driver.find_element_by_class_name('geetest_commit_tip')
@@ -86,7 +88,7 @@ def sign_in(driver):
 
 
 def get_image(driver):
-    time.sleep(2)
+    time.sleep(8)
     element = driver.find_element_by_class_name('geetest_widget')
     vc_image = get_vc_image(element)
     return vc_image

+ 4 - 3
VerificationCode/mcbbs/reply.py

@@ -22,9 +22,10 @@ def start_reply(driver, content):
     except NoSuchElementException:
         return False
     else:
-        temp = ActionChains(driver).move_to_element(message)
-        time.sleep(8)
-        temp.double_click().perform()
+        ActionChains(driver).move_to_element(message).perform()
+        time.sleep(3)
+        ActionChains(driver).double_click(message).perform()
+        time.sleep(3)
         message.send_keys(content)
         print(content)
         time.sleep(1)

+ 2 - 0
VerificationCode/mcbbs/task.py

@@ -41,6 +41,7 @@ def submit(driver, i):
             i = i + 1
             return i
         else:
+            driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
             ActionChains(driver).move_to_element(button_submit).click().perform()
             return -1
 
@@ -72,6 +73,7 @@ def complete(driver, i):
         time.sleep(2)
         driver.get(url)
         time.sleep(2)
+        driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
         button_submit = driver.find_element_by_xpath("//table[@class='tfm']/tbody/tr[3]/td[2]/p/a[1]/img")
         if button_submit.get_attribute('src') == 'https://www.mcbbs.net/static/image/task/rewardless.gif':
             i = int(i)

+ 2 - 2
VerificationCode/ttshitu.py

@@ -17,6 +17,6 @@ def base64_api(uname, pwd, img):
 
 
 def error_report(rid):
-    d = {"id", rid}
-    result = json.loads(requests.post("http://api.ttshitu.com/reporterror.json", data=d).text)
+    d = {"id": rid}
+    result = json.loads(requests.post("http://api.ttshitu.com/reporterror.json", json=d).text)
     return result["success"]