As part of a practice project me and a friend are writing a script to make the Asset Management Software easier. We're automating filling in the required fields and pressing all the buttons required to check out for example a phone. After searching for a specific device there are two options: - device is found and is available, thus can be checked out - device is found but not available, thus can't be checked out
To achieve this we wrote an if-statement, checking for the 'Checkout' or 'Checkin' and accordingly gives us the next options.
We have tried all kinds of things with indentations, reversing the order of the statements, ... The script just never seems to get to the 'else' point. When current status is 'checkin' it gives the messagebox asking to start over, but when the current status is 'checkout' it never actually prints the '5000'.
We've also tried having an elif instead of else, specifying: elif browser.find_element_by_xpath('//*[@title="Check this item out"]'): But even then, it never actually comes to the point of going into the else.
if browser.find_element_by_xpath('//*[@title="Check this item in so it is available for re-imaging, re-issue, etc."]'):
print("1")
statusResult = tk.messagebox.askquestion('Device not available', 'Device has been checked out already. Do you wish to start over?', icon='warning')
if statusResult == 'yes':
print("2")
elif statusResult == 'no':
print("3")
else:
print("5000")
When status is 'checkin', the messagebox needs to popup asking to start over (this is working). When status is 'checkout', the script needs to move to the else-statement and print 5000 as an example.
Aucun commentaire:
Enregistrer un commentaire