from selenium import webdriver
from datetime import datetime, date, timedelta
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import pandas as pd
from pandas import DataFrame,Series
import time
driver=webdriver.Chrome()
#访问链接
driver.get('http://10.32.125.11:8080/WebReport/ReportServer?op=fs_load&cmd=fs_signin&_=1608021693346')
driver.maximize_window()
#找到目标
driver.find_element_by_xpath("//input[@placeholder='用户名']").send_keys("aic") # 用户名
time.sleep(3)
driver.find_element_by_xpath("//input[@placeholder='密码']").send_keys("aic321")#密码
time.sleep(3)
driver.find_element_by_xpath("//a[@id='fs-login-btn']").click() #登录
time.sleep(3)
driver.find_element_by_xpath("//span[@title='出行平台_技能分组']").click()
time.sleep(3)
driver.find_element_by_xpath("//span[@title='业务统计']").click()
time.sleep(3)
driver.find_element_by_xpath("//span[@title='工单查询']").click()
time.sleep(3)
driver.find_element_by_xpath("//span[@title='工单详情统计报表(基础信息)']").click()
driver.switch_to_frame(driver.find_elements_by_tag_name('iframe')[1])
time.sleep(39600)
driver.find_element_by_xpath("//table[@id='fr-btn-WIDGET11_C']").click()# 点击查询
time.sleep(1800)
#导出excel
#点击开始时间
driver.find_element_by_xpath("//button[@class='fr-btn-text x-emb-export']").click()
time.sleep(3)
driver.find_element_by_xpath("//div[@class='menu-icon x-emb-excel']").click()
time.sleep(3)
ActionChains(driver).move_by_offset(1000,200).click().perform()#点击结束日期
ActionChains(driver).move_by_offset(-1000,-200).perform()
time.sleep(1800)