Lemoncase2 is a Javascript-like scripting language,which is used for developing scripts in Lemonce. Read this guide to help you understand the language.


Grammar


Zoom Table

Instruction keyword Action keyword Expression Macro Magic keyword
import click / dbclick <@”selector“> #TIMES $HREF
process input…by <#”selector“> #AUTOWAIT $BUTTON
return move <!”selector“> #LIMIT $IT
for…in hold A~~B $LOOP
for…of drop A==B
if…else scroll A!=B
continue jumpto RegExp
while wait
log assert
forward / back
refresh
upload

Identifier

Lemoncase2 is similar to JS in identifiers.

var a = 1; // You have to identify 'var' in JS.
//On the contrary, you do not have to use 'var' keyword in LC2.
//So this is a wrong statement in Lemoncase.
a = 1;
a = true;


Datatype

The following shows a list of data types which can be used in LC2.

  • number (e.g., 0.12, 1e-3)
  • string (e.g., ‘you’, “me”)
  • Boolean (true/false)
  • RegExp

When you use ~~ operator, the RegExp will be used to match the string, otherwise it will generate a random string based on the RegExp.

RegExp can be used it if you want to do some fuzzy testing.


Instruction keyword

Below are the instruction keywords in LC2. Read more.

  • import
  • process (main/sub)
  • return
  • for…in/of
  • if…else
  • continue
  • while
  • log


Action keyword

Below are the action keywords in LC2. Read more.

  • click/dblclick
  • input…by
  • move/hold/drop
  • scroll
  • jumpto
  • back/forward/refresh
  • wait
  • assert
  • upload


Expression

Below are the expressions in LC2. Read more.

  • <# “selector” />
  • <@ “selector” />
  • <! “selector” />
  • “stringA” ~~ “stringB”
  • “stringA” ~~ /RegExp/
  • “stringA” == “stringB”
  • [var] == [var]????


Selector

Below are the type of selectors applied in Lemoncase2.Read more.

  • css selector
  • xpath
  • sizzle


Native sub-process

Below are the types of the inbuilt sub-process in LC2. Read more.

  • now/format
  • bool/number/string
  • abs/ceil/floor/max/min/random
  • length/charAt/indexOf/substr/trim
  • length/for…in/for…of/indexOf


Macro

Macro is the global setting for your case during runtime. Read more.

  • #TIMES
  • #AUTOWAIT
  • #LIMIT


Magic keyword

Below are the magic keywords which stand for some special functions. Read more.

  • $HREF
  • $BUTTON
  • $IT
  • $LOOP


Scope


Global scope. There is no return keyword in LC2.The main process has no parameter.process main { } is the program’s entry.


Example


Here are some examples for you to get started with the LC2 language. Read more.

Hello World

A Typical test case

Typical examples