import time import webbrowser from selenium import webdriver from selenium.common.exceptions import UnexpectedAlertPresentException from selenium.webdriver import ActionChains import pyperclip from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait

d=webdriver.Edge() d.get('https://tradinglive-testwebpc.tostar.top/cn/login')

WebDriverWait(driver=d, timeout=30, ignored_exceptions=None).until(EC.presence_of_all_elements_located( (By.XPATH, '//div[contains(@class,"region-select")]//input'))) number = "+852"

d.find_element_by_xpath('//div[contains(@class,"region-select")]//input').send_keys(number) time.sleep(1)

d.find_element_by_xpath('//li[contains(string(),"{}")]'.format(number)).click() time.sleep(1) d.find_element_by_css_selector('[placeholder="请输入手机号"]').send_keys('91111111')

d.find_element_by_css_selector( '#app > div.container-layer.app-view.bg > div.container_content > div > div > form > div.phone-verification-component > form > div > div.el-col.el-col-10 > button > span').click()

time.sleep(2)

iframe = d.find_element_by_xpath('//*[@id="app"]/div[1]/div[2]/div/div/form/div[1]/div[2]/iframe') d.switch_to.frame(iframe)

span_background = d.find_element_by_xpath('//*[@id="app"]/main/div/div/div[2]') span_background_size = span_background.size print('滑块背景大小:',span_background_size)

button = d.find_element_by_xpath('//*[@id="app"]/main/div/div/div[2]/i') button_location = button.location print('滑块位置:',button_location)

x_location = span_background_size["width"] y_location = button_location["y"] button_end_location = button_location['x']+x_location print(button_end_location) print('滑块移动的位置:',button_end_location, y_location)

source = WebDriverWait(d, 30).until(EC.presence_of_element_located( (By.XPATH, '//*[@id="app"]/main/div/div/div[2]/i'))) ActionChains(d).click_and_hold(on_element=source).perform() ActionChains(d).move_to_element_with_offset(source, xoffset=button_end_location, yoffset=y_location).perform() time.sleep(0.3) ActionChains(d).pause(1).release().perform()

import timeimport webbrowser# from telnetlib import ECfrom selenium import webdriverfrom seleniumcommonexceptions import UnexpectedAlertPresentExceptionfrom seleniumwebdriver import ActionChainsimport

原文地址: http://www.cveoy.top/t/topic/b5Wp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录