自动出借
import timefrom selenium import webdriver# import os#Busername = "18200717108" # 请替换成你的用户名password = "123456Aa" # 请替换成你的密码code = 121#driver = webdriver.Chrome() # 选择Chrome浏览器或者用下面的浏览器,看心情driver = webdriver.Firefox()# driver=webdriver.Safari()driver.maximize_window()#Adriver.get('http://test-a.shoujinwang.cn/systLogonUser/login.do') # 打首金网登录页面#B# driver.get('http://118.178.247.67:8081/systLogonUser/login.do') # 打首金网登录页面#C#driver.get('http://10.253.125.38:8081/systLogonUser/login.do') # 打首金网登录页面# time.sleep(1)#找到用户名输入框点击获取焦点并输入信息driver.find_element_by_id('userName').click()driver.find_element_by_id('userName').send_keys(username)#找到密码输入框点击获取焦点并输入信息driver.find_element_by_id('pwd').click()driver.find_element_by_id('pwd').send_keys(password)# 找到图形验证码输入框点击获取焦点输入信息driver.find_element_by_id('verifyCode').click()driver.find_element_by_id('verifyCode').send_keys(code)# 找到登录按钮点击driver.find_element_by_id('login').click()time.sleep(3)driver.find_element_by_partial_link_text('我要出借').click()# driver.find_element_by_partial_link_text('//*[@id="header"]/div/div/div/div[2]/div/ul/li[2]/a').click()time.sleep(3)## driver.find_element_by_class_name('bg').click()driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/div/div[1]/div/div/ul/li[2]').click()time.sleep(3)driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/div/div[2]/div[2]/div/div[2]/div[3]/div[1]/ul[2]/li[3]').click()time.sleep(3)driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/div/div[2]/div[2]/div/div[2]/div[3]/div[1]/ul[3]/li[2]').click()time.sleep(3)driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/div/div[2]/div[2]/div/div[3]/div[3]/ul/a[1]/li').click()time.sleep(3)windows = driver.window_handlesdriver.switch_to_window(windows[1])#立即出借driver.find_element_by_id('ljtz').click()time.sleep(4)# windows = driver.window_handles# driver.switch_to_window(windows[2])#出借复选框driver.switch_to_frame(driver.find_element_by_id('agreed').click())time.sleep(3)#出借弹窗中立即出借driver.switch_to_frame(driver.find_element_by_xpath('//*[@id="invest-product"]/div[5]/div/div[1]/div[3]').click())time.sleep(10)# driver.execute_script('window.open()')# driver.get('http://111.205.207.103:10101/tradeBank/trans/investApplyByCust.html')# sreach_window=driver.current_window_handle #此行代码用来定位当前页面# driver.refresh()windows = driver.window_handlesdriver.switch_to_window(windows[1])driver.find_element_by_id('SIPBox1').click()driver.find_element_by_id('SIPBox1').send_keys('123456Aa')time.sleep(5)driver.find_element_by_xpath('/html/body/div[3]/div[2]/div[2]/div/button').click()