click / dblclick
click/dblclick “selector“;
Click or double click a HTML element.process main () { // Deepin Technology Community jumpto "https://www.deepin.org/en/"; wait 2333; // dblclick dblclick '#hs-site-navigation > .hs-toggle-menu'; wait 2323; // click click '#hs-site-navigation > .hs-toggle-menu'; }
input…by
input “selector“ by “string”;
input a string to a text area.// eg: id="link" class="case" input 'div#link.case' by "hello world.";
move
move “selector“;
Trigger onmouseenter or onmouseleave events on a HTML element. This action can trigger CSShover.process main () { jumpto "https://www.deepin.org/en/"; wait 2333; click '#hs-site-navigation > .hs-toggle-menu'; // Move on the 3 elements in the following. move '#menu-main span:contains(Projects)'; move '#menu-main span:contains(Download)'; move '#menu-main span:contains(Documents)'; }
hold
hold “selector“;
Hold an element by mouse continuely. The specific example is shown in thedrop
below.
drop
drop;
Release an element by mouse.process main () { jumpto "https://jqueryui.com/draggable/"; wait 2333; //Click on an element in the page, use `move` to achieve drag and pointer movement. hold '#content > iframe:nth-child(5) < #draggable'; move '#content > iframe:nth-child(5) < html'; //Release the element. drop; }
scroll
scroll “selector“;
Scroll the page and keep the selected element in the center of the screen.process main () { jumpto "http://www.lemonce.com"; wait 2333; //scroll scroll 'footer'; }
jumpto
jumpto “URL”;
jump to a URL.back / forward / refresh
back;
forward;
refresh;
forward
move forward to the next page; back
move back to the previous page;refresh
refresh the current page.
process main () { // The world's leading software development platform · GitHub jumpto "https://github.com/"; wait 2333; // Sign up click "a:contains(Sign up)"; wait 2000; //back back; wait 2000; //forward forward; wait 2000; //refresh refresh; }
wait
wait [time:number]
Wait a few time like a person[in milliseconds].//Editor will wait 3000ms to start the next action. wait 3000;
assert
assert [expression] in [time:number]
Assert that the expression is true [within certain time]. More about expression.//Asserts the existence of a input box with the id of "test". assert <#"textarea#test">; //Asserts that a input box with the id of "test" will appear in 2 seconds. assert <#"textarea#test"> in 2000; process main () { // The world's leading software development platform · GitHub jumpto "https://github.com/"; // wait wait 2333; // click "login" click "#user\\[login\\]"; // assert assert <@'h1'> ~~ "Built" in 1000; }@'h1'>#"textarea#test">#"textarea#test">
upload
upload [“filePath1”,”filePath2”]
If a test needs to upload a file to a web application, you can use theupload
command to upload. There’s one example in the following.
Attention:For Windows users, scine ‘\’ is used in the system path, you need to change ‘\’ to ‘/‘ or use escape character like ‘\\’ to ensure lemonce runs successfully. For example, ‘C:\Users\1.img’ needs to be transformed into ‘C:/Users/1.img’ in lemonce.
#AUTOWAIT 1000 process main () { // Angular file upload - flow.js jumpto "http://flowjs.github.io/ng-flow/"; wait 3333; // Click 'Basic upload'. click "div.ng-scope > .drop > span.btn-default"; upload ["C:/1.lc2"]; wait 4000; // Click 'Single image upload'. click "body > div:nth-child(1) > section:nth-child(2) > div:nth-child(10) > div:nth-child(4) > span:nth-child(1)"; upload ["C:/1.jpg","D:/2.png"]; // Lemonce will upload the first file by default when only one file is supported. wait 4000; }