我最近写了一个Python程序,自动提取Excel数据,用Selenium统计Jiras数据,并写入Excel。
1.openPage
打开并登录Jira,打开需统计的jira的页面,页面的search文本框,输入查询条件,就是sql语句,在jira中,叫做 jql.
2.statistic
统计jira数据,并写入Excel。
从Excel读取要搜索的条件:读取这个 sheet :“JiraData”
读取jira页面的记录总数,写入 Excel的 sheet:Sum
遍历jira中的bug 表格,并写入Excel的各个 sheet。
# -*- coding: utf-8 -*-
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
import Write_excel
wr = Write_excel.Write_excel('SasaiBugStatistic.xlsx')
sheetNames=['PaymentProduct','LiveProduct','OthersProduct','AllProduct','PaymentPreProduct','LivePreProduct','OthersPreProduct','AllPreProduct']
driver = webdriver.Chrome()
def openPage():
i = 2
driver.get("http://***:36808/login.jsp")
sleep(2)
el = driver.find_element(By.ID, "login-form-username")
el.send_keys("***")
el = driver.find_element(By.ID, "login-form-password")
el.send_keys("***")
el = driver.find_element(By.ID, "login-form-submit")
el.click()
sleep(5)
urlSearch = "http://202.104.66.150:36808/issues/?jql=project%20in%20(CUB%2C%20ANDROIDUAT%2C%20IOSUAT%2C%20ANDROIDPRO%2C%20BACKENDPRO%2C%20IOSPROD)%20AND%20status%20in%20(Open%2C%20%22To%20Do%22%2C%20Reopened)%20AND%20affectedVersion%20in%20(%222.9.17%20production%22%2C%20%222.9.18%20%20production%22%2C%20%222.9.18%20production%22%2C%20%222.9.19%20%20production%22%2C%20%222.9.19%20production%22%2C%20%222.9.20%20%20production%22%2C%20%222.9.20%20production%22%2C%20%222.9.21%20%20production%22%2C%20%222.9.21%20production%22%2C%20%222.9.22%20%20production%22%2C%20%222.9.22%20production%22%2C%20%222.9.23%20%20production%22%2C%20%222.9.23%20production%22%2C%20%222.9.24%20Production%22%2C%20%222.9.25%20Production%22%2C%20%222.9.26%20production%22%2C%20%222.9.27%20production%22%2C%20%222.9.28%20Production%22%2C%20%222.9.29%20Production%22%2C%20%222.9.30%20production%22)%20AND%20component%20in%20(%22EcoCash%20Wallet%20APP%22%2C%20Remittances%2C%20%22Sasai%20Wallet%20APP%22%2C%20%22Sasai%20Wallet%20Management%20portal%22%2C%20%22Sasai%20Wallet%20Merchant%20portal%22%2C%20Wallet)%20ORDER%20BY%20created%20ASC%2C%20status%20ASC%2C%20summary%20ASC%2C%20affectedVersion%20ASC"
driver.get(urlSearch)
def statistic():
row = 3
sheetIndex