[英]How to click a button on a Jira ticket using python and the JIRA module
我們有一個更新jira票證的流程,我已使用以下代碼自動化並使用python 6.4中的JIRA包。 哪個工作完美...但是他們在流程中添加了一個新步驟,要求我點擊“批准”按鈕,以便'customfield_12410'出現在一個單獨的彈出窗口中,其他字段需要更新。
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
jira_issue.update(fields={'customfield_12410': comment})
此代碼現在生成的錯誤是:
text: Field 'customfield_12410' cannot be set. It is not on the appropriate
screen, or unknown.
如何單擊Jira票證上的按鈕。 通過打印票證的原始內容,我看不到任何類似於按鈕名稱的內容。
print(jira_issue.raw)
謝謝,
約翰。
已解決以下代碼
from jira.client import JIRA
jira_server = "http://jiraserver"
jira_password = f.read()
jira_user = getpass.getuser()
jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))
comment = "Test Results. Passes {0} Failed {1}".format(passed,failed)
# Get ticket information
jira_issue = jira.issue(ticketId)
transitions = jira.transitions(jira_issue)
for t in transitions:
print(t['id'], t['name'])
Output:
12 Approval
14 Cancel
# Resolve the issue with the comment
jira.transition_issue(jira_issue, '12', fields={'customfield_12410': comment})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.