Comments (4)
Hi @thim81 yes, you can use below statement directly as TagUI will recognize the ;
at the end of the line and interpret it as JavaScript. Using var
is not wrong but in many cases, defining as local variable (for example in a popup step or frame step) will make it inaccessible in later parts of your automation. In general, defining directly using variable_name = value;
is easier to make it accessible throughout.
project_name = "MarcoPolo" + Math.floor(Math.random()*200);
Sample automation flow 9 has some more examples of using variables -
https://github.com/tebelorg/TagUI/blob/master/src/samples/9_misc
from tagui.
Hi @kensoh,
You were right removing the var
helped with the strange behaviour that sometimes the variable became undefined
Thanks for the great help.
from tagui.
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 var
declares a local variable within the context of that particular code block, which may allow the variable to be accessed directly if the reference happens within the same code block. But that will most likely fail in subsequent steps, unless the next steps are simple steps such as echo which does not really do all those handling of web element.
Declaring directly using variable_name = value;
is recommended and should make it accessible throughout the automation steps.
from tagui.
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.
#30 - add variable_name step to show how to define a variable manually for use
#30 - set variable without typing ; at the end
; 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.
from tagui.
Related Issues (20)
- How to get name of the latest downloaded file?
- No support for JS ES6 syntax
- Difference fron Cucumber.js?
- [RPA][ERROR] - TagUI process ended unexpectedly - ERROR - undefined is not an object (evaluating 'e.message.charAt') HOT 1
- run next code giving fault: F:\tagui\src>tagui f:\tagui\flows\samples\1_google.tag
- Method in Tagui HOT 1
- Text not found
- Is it possible to get name of the latest downloaded file?
- Read method issue
- Is there any support for google sheets?
- Is the project no longer under maintenance
- I don't see any updates on the issues. Is this project still active?
- Can we create a method for reuse across various places? HOT 1
- how to use tagui using api directive to post a flie to Remote machine HOT 10
- 请教下,现在有个需求就是要在当前已经打开的浏览器用tagui执行流程,非临时浏览器,有啥办法或者思路去实现吗?谢谢 HOT 1
- how to use casper object in tagui script? HOT 1
- 请教下对于打开页面 不管直接是http://xxx.com 或者是popup xxx 有没有办法监听他们加载完成后再执行操作?
- Do you have support for google sheets?
- difference between present() and exist()? HOT 1
- what is the default auto-captioning models directory on windows?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tagui.