Skip to content
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

Can TagUI not exit on error (for example element not found)? #251

Closed
kensoh opened this issue Jul 26, 2018 · 3 comments
Closed

Can TagUI not exit on error (for example element not found)? #251

kensoh opened this issue Jul 26, 2018 · 3 comments
Labels

Comments

@kensoh
Copy link
Member

kensoh commented Jul 26, 2018

from user's query in issue #148

@kensoh kensoh added the query label Jul 26, 2018
@kensoh
Copy link
Member Author

kensoh commented Jul 26, 2018

Full details at #148, but below is the conclusion and workaround if user really really wants that.


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
https://github.com/kelaberetiv/TagUI#visual-automation

Below sample automation script shows after making above replacement, TagUI does not exit on error.

sample

https://google.com
click test_error_element
type q as testing[enter]
wait 5 seconds
click test_error2_element
click test_error3_element
echo 'end of test'

tagui sample chrome

START - automation started - Thu Jul 26 2018 22:36:19 GMT+0800 (+08)
https://google.com - Google

click test_error_element
ERROR - cannot find test_error_element
type q as testing[enter]
wait 5 seconds
click test_error2_element
ERROR - cannot find test_error2_element
click test_error3_element
ERROR - cannot find test_error3_element
end of test

https://www.google.com/search?source=hp&ei=Y9xZW6OqIYfWvgTZwomYDQ&q=testing&oq=testing&gs_l=psy-ab.12..0i131k1j0l9.13427.14059.0.14577.7.7.0.0.0.0.69.310.7.7.0....0...1c..64.psy-ab..0.7.310....0.axPdS6U6ZBI - testing - Google Search
FINISH - automation finished - 48.6s

@kensoh kensoh closed this as completed Jul 26, 2018
@kensoh
Copy link
Member Author

kensoh commented Jul 26, 2018

fyi @adegard @Aussiroth @lohvht @alvinphee @chiotkk - if you ever encounter a situation where really need TagUI not to quit on error encountered, there is a workaround above.

But not recommended, because it can easily encourage bad automation script design..

@adegard
Copy link
Contributor

adegard commented Jul 26, 2018

Hi @kensoh thanks for your suggestion but I prefer checking the presence of selector, because I don't now what are the consequences if code continue without control!!
thanks ;-)

if present(element_selector)
{
//doing stuff
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants