-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try catch to catch errors in TagUI during automation #148
Comments
Can you tell me more about your use scenario? JavaScript has try-catch blocks, but it probably can't catch when an UI element cannot be found. Because when the element cannot be found, that scenario has been pre-planned and an error message is shown instead. Right now, I'm working on a major rewrite of TagUI. I notice some situations where the execution order is not sequential, so am rewriting the internal design so that it is more deterministic and can make use of if and else statements better. Of course, the rewrite I am working to maintain backward compatibility of existing scripts as priority, while finding ways to work around JavaScript technical limitations. An example of specific scenarios where the execution order is not perfect is below. It outputs 1, 3, 2. The rewrite aims to address this. Not sure if you have come across some behavior like below while you develop automations for your scenarios?
update - above-mentioned major rewrite implemented in cutting edge release - #150 |
Response from user The try-catch block is mainly for performing transactions in My response to that I see.. That's good :) Since we are on the topic, may I gather some more ideas from you on this try-catch thing / ability to continue running even when error is encountered? In theory I can try adding a new option to let TagUI not quit when an error of not finding an expected element is encountered. But usual UI workflow is such that if a step is not done, subsequent steps would likely cause error data entry into the application or result in more errors. Thus I made the default by design to quit on error. Users can also set the timeout to be much larger in tagui_config.txt or use the timeout step to temporarily set to a large number of seconds. No need to reply, but if offhand you have more inputs or ideas on this topic, I can chew over and see if there is some improvement that I can make to TagUI to handle such scenarios. |
I believe the option to not quit on error is very much needed and should be incorporated. I have a situation where an element is not found by TagUI. If I am able to determine this, I can control the flow to use different approach like sikuli block. Believe currently this is not possible. |
Hey @dinesh3434 it is bad automation program to not quit on error. If you really really want that, you can modify tagui_parse.php, search and replace '.exit()' with blank '' and it may be able to make program not quit on exit. For the current version, there should be 8 replacements of '.exit()' to blank ''. But I wont adjust the TagUI default code base to support something like that. Because it will just lead to more badly designed automation scripts by users. Also, you can use functions such as present(), visible() which can be used for web elements or sikuli visual automation to detect if an element is on the screen. So it should be able to be handled by good automation program design instead of relying on not exiting when error is encountered - https://github.com/kelaberetiv/TagUI#helper-functions Below sample automation script shows after making above replacement, TagUI does not exit on error. sample
tagui sample chrome
|
Raising this issue on behalf of user email so that other users can benefit -
In Sikuli there is “Try Catch” error-handling command https://answers.launchpad.net/sikuli/+question/229988.
Does TagUI have something similar?
The text was updated successfully, but these errors were encountered: