-
Notifications
You must be signed in to change notification settings - Fork 582
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
Q: How to set a general variable? #30
Comments
Hi @thim81 yes, you can use below statement directly as TagUI will recognize the project_name = "MarcoPolo" + Math.floor(Math.random()*200); Sample automation flow 9 has some more examples of using variables - |
Hi @kensoh, You were right removing the Thanks for the great help. |
Adding on for future reference by other users the technical reason for that - TagUI converts the natural-language-like syntax into CasperJS syntax JavaScript code to run automation. So a simple 1 line step in many cases will be converted into a more elaborate code block which does auto-waiting of the web element to appear, error handling and timeout when it does not appear, and taking the action when it appears. Using Declaring directly using |
https://github.com/tebelorg/TagUI/issues/41 & https://github.com/tebelorg/TagUI/issues/37 - include http(s):// step to make it clearer the step keyword that is detected for url intention https://github.com/tebelorg/TagUI/issues/40 - make it even clearer api_result is a text variable and api_json is a JSON object https://github.com/tebelorg/TagUI/issues/39 - small adjustment to make api_config more obvious as a user missed that part https://github.com/tebelorg/TagUI/issues/36 - update to further emphasize CasperJS assertions don't work with Chrome https://github.com/tebelorg/TagUI/issues/30 - add variable_name step to show how to define a variable manually for use https://github.com/tebelorg/TagUI/issues/29 - minor update to emphasize test option to use CasperJS test framework - add (on new line) to // step to emphasize entering // on a new line. using click abc // user comment will fail as the comment part is being treated as part of the selector. XPath selector has // and there is no way to distinguish if accept // as denoting comment
; is used to detect that it is a valid JavaScript code variable assignments are so often used that detecting = should be acceptable, since that check is done at the very end of checking for TagUI steps and other JavaScript keywords. So the following will now work and be more convenient. Update readme only when making new release and packaged installations. a = 1 b = ‘b’ c = ”c” Adding on, reason for JavaScript checking instead of taking anything that is not TagUI step as JavaScript is to try to catch as much user error as possible before even running an automation flow. This speeds up development time rapidly without going through all the steps during automation just to run into a user code error.
Added 2 commits related to this issue. Readme improvement to show how to define variable. And a new commit to simply recognize a = 1 as a valid statement to define variable. So that ; is not needed at the end. Commit comments below with more info, especially the note why where possible TagUI tries to throw error if it is not valid JavaScript code.
|
Hi Ken,
Another question, is it possible to set a general variable at the beginning of a flow, that can be used everywhere in the flow?
Example:
The text was updated successfully, but these errors were encountered: