from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from chaojiying import Chaojiying_Client
from selenium.webdriver.common.action_chains import ActionChains
# from selenium.webdriver.chrome.options import Options
# option = Options()
# Options.add_argument("--disable-blink-features-AutomationControlled")
import time
web = Chrome()
web.maximize_window()
web.get("https://www.chaojiying.com/user/login/")
time.sleep(3)
web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/p[1]/input").send_keys("13582413297")
time.sleep(3)
web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/p[2]/input").send_keys("lfsysc0104")
time.sleep(3)
img=web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/div/img")
chaojiying = Chaojiying_Client('13582413297', 'lfsysc0104', '962267')
dic=chaojiying.PostPic(img.screenshot_as_png, 1902)
mycode=dic['pic_str']
#这段程序注意你将返的两个或多个坐标进行分割
# list = mycode.split("|")
# for re in list:#再进行分割得到x和Y和数值
# x = int(re.split(",")[0])#取整
# y = int(re.split(",")[1])
# ActionChains(web).move_to_element(img,x,y).click().perform()#进行处理点击,相对于img.后边要跟perform()
web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/p[3]/input").send_keys(mycode)
time.sleep(10)
web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/p[4]/input").click()
time.sleep(5)
# btn=web.find_element(By.XPATH,"/html/body/div[3]/div/div[3]/div[1]/form/p[3]/input")
# ActionChains(web).drag_and_drop_by_offset(btn,300,0).perform()
#这部分是拖动滑到最后,300是水平偏移量,0是在竖直方向不移运动。
time.sleep(100)
selenium自动化登陆页面,包括8个图形识别和滑动块的处理
最新推荐文章于 2025-03-04 18:19:48 发布
8207

被折叠的 条评论
为什么被折叠?



