生活随笔
收集整理的這篇文章主要介紹了
python批量处理jira上的issue
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
公司使用的jira系統做為日常處理bug的系統,有一天同事突然給我轉來100多個bug,說是和我已經fix的一個bug是相同的,讓我把這些bug處理掉(fix掉)。我首先想到的是批處理,但是操作好久,似乎jira的批處理不好使 …
遂想到一個python腳本搞定。掛在電腦上,利用中午吃飯的時間,python腳本替我關閉了這些bug。
源碼如下所示,雖然沒有參考意義,但是這個思路還是值得記錄下,便于下次使用。
import sys
import os
import shutil
import timefrom selenium import webdriver
from selenium
.webdriver
.common
.action_chains import ActionChains
from selenium
.webdriver
.common
.keys import Keys
import urllib
.requestimport jsonimport _threadbuf
= '''
原因分析:
1
修改方案:
1
自測結果:
1
測試建議:
1
'''def
test():print(buf
)options
= webdriver
.ChromeOptions()# options設置chrome位置options
.binary_location
= r
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"# 配置到實例driver
= webdriver
.Chrome(chrome_options
=options
)driver
.set_page_load_timeout(10) # 設置超時時間為
5秒,如果
5秒后網頁還是沒有加載完成則拋出異常driver
.get('http://jira.xxxxxx.com/projects/FANSPRO/issues')driver
.refresh()driver
.find_element_by_id("login-form-username").send_keys("xxxx")driver
.find_element_by_id("login-form-password").send_keys("xxxxx")driver
.find_element_by_id("login-form-submit").click()time
.sleep(1)driver
.find_element_by_xpath('//*[@id="action_id_4"]').click()time
.sleep(1)driver
.find_element_by_xpath('//*[@id="action_id_771"]').click() # FIXtime
.sleep(1)driver
.find_element_by_id('customfield_10402').send_keys(buf
)time
.sleep(1)driver
.find_element_by_id("issue-workflow-xxxxx-submit").click()time
.sleep(1)driver
.find_element_by_id("action_id_781").click() #Solve issuetime
.sleep(1)ActionChains(driver
).send_keys(Keys
.TAB
).perform()ActionChains(driver
).send_keys(Keys
.TAB
).perform()ActionChains(driver
).send_keys(Keys
.TAB
).perform()time
.sleep(1)ActionChains(driver
).send_keys('1').perform()time
.sleep(1)driver
.find_element_by_id("issue-workflow-xxxxxx-submit").click()driver
.quit()if __name__
== '__main__':print(str(sys
.argv
[0]) + " enter")i
= 0for num in
range(1,9): i
= i
+1print("===================================================:%s" % (i
))test()time
.sleep(200)
總結
以上是生活随笔為你收集整理的python批量处理jira上的issue的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。