You can get some informations of your campaign from TheCampaign object.
{ "id": 123, "url": "http://google.com", "duration": 15 }
//For example, to get the campaign ID, you can use TheCampaign.id
Print one or more message to the Macros Editor output.
Parameters:await WaitForLoading (); Log("hello", new Date(), EvalScript ("location.href"));
Pause the script for a period of time in milliseconds
Parameters:await Delay(3000);//delay for 3 seconds await Delay(3000, 10000);//delay random between 3-10 seconds
Returns a random integer that is within a specified range.
Parameters:Take a random item from an array.
Parameters:let randomKeyword = RandomArray(["traffic exchange", "auto surf"]); Log (randomKeyword);
Click on an area on your website based on coordinates.
Parameters:await ClickByCoordinates(100, 100, 200, 200); await ClickByCoordinates(100, 100, 200, 200, 2);
You can also get the coordinates from the Macros Editor like this
Click on an element based on css selector.
Parameters://click to a link that contains 9hits.com await ClickBySelector("a[href*='9hits.com']"); //click to a button with id #submit, inside an iframe which has src starts with http://9hits.com await ClickBySelector("button#submit", 0, 1, "http://9hits.com", "src-starts"); //click to a button with id #submit, inside an iframe which has src equals to http://9hits.com/contact.html await ClickBySelector("button#submit", 0, 1, "http://9hits.com/contact.html", "src-equals"); //click to a button with id #submit, inside an iframe which has src ends with /contact.html await ClickBySelector("button#submit", 0, 1, "/contact.html", "src-ends"); //click to a button with id #submit, inside an iframe which has src contains 9hits.com await ClickBySelector("button#submit", 0, 1, "9hits.com", "src-contains"); //click to a button with id #submit, inside an iframe which has src matched regex \d+hits\.com await ClickBySelector("button#submit", 0, 1, "\d+hits\.com", "src-regex"); //click to a button with id #submit, inside the first frame await ClickBySelector("button#submit", 0, 1, "0", "frame-path"); //click to a button with id #submit, inside the 2nd frame of the first frame await ClickBySelector("button#submit", 0, 1, "0>1", "frame-path");
Are you confused? Don't worry! You can also generate this click command easily by using the Macros Editor like this
Click on an element based on its ID.
Parameters:await ClickById("load-more-button");
Click on an element based on its xpath.
Parameters:await ClickByXpath("/html/body/div/div[1]/div/ul/li[6]/a/div[1]/span"); await ClickByXpath(GenerateXpath("a", "href", "https://9hits.com%"));
Click on an element based on its tag name.
Parameters:await ClickByTag("a"); //click to the first link element await ClickByTag("a", 1); //click to the 2nd link element await ClickByTag("a", "random"); //click random a link
Click on an element based on its class name.
Parameters:await ClickByClass("skip-button"); //Click to the first element has class name "skip-button" await ClickByClass("skip-button", 1); //Click to the 2nd element has class name "skip-button" await ClickByClass("skip-button", "random"); //Click to the random any element has class name "skip-button"
Randomly click any link on your website.
Parameters:await ClickRandomLink();
Randomly click any internal link on your website.
Parameters:await ClickRandomInternalLink();
Randomly click any external link on your website.
Parameters:await ClickRandomExternalLink();
Set the value for an attribute of an element based on its ID.
Parameters:SetById("email", "value", "[email protected]");
Set the value for an attribute of an element based on its xpath.
Parameters:await SetByXpath ('//input[@type="email"]', 'value', '[email protected]');
Set the value for an attribute of an element based on its class name.
Parameters:SetByClass("text-box", "value", "text value"); SetByClass("text-box", "value", "text value", 2); SetByClass("text-box", "value", "text value", "random"); SetByClass("text-box", "value", "text value", "all");
Set the value for an attribute of an element based on its tag name.
Parameters:await SetByTag("input", "value", "text value");
SetByTag("input", "value", "text value", 2);
SetByTag("input", "value", "text value", "random");
SetByTag("input", "value", "text value", "all");
Execute javascript code on the website and return value.
Parameters:let loc = EvalScript ('window.location'); loc.href="https://9hits.com"; Log(loc);
Create xpath to target the element. You can combine this function with ClickByXpath, SetByXpath or any function which use xpath.
Parameters://a link has href = "http://google.com" GenerateXpath("a", "href", "http://google.com"); //a link has href starts with "http://google" GenerateXpath("a", "href", "http://google%"); //a link has href ends with "google.com" GenerateXpath("a", "href", "%google.com"); //a link has href contains "google" GenerateXpath("a", "href", "%google%");
Get the value of an attribute of an element based on its xpath.
Parameters:let result = GetAttribute ('//input[@type="email"]', 'value'); Log (result);
Get the coordinates of an element.
Parameters:let pos = GetElementPos ("document.getElementById('submit-button');"); //Return: object {X1: 100, Y1: 100, X2:200, Y2: 200} if(pos) { ClickByCoordinates(pos.X1, pos.Y1, pos.X2, pos.Y2); }
Return the browser size.
Example:let size = await GetBrowserSize(); //Return: object {width: 1000, height: 800}
Return the source code of the website.
Return the HTML code of the website.
Return the current URL.
Return the current User-Agent.
Indicates that the browser is loading or not.
Indicates that the browser is mobile or not (base on the User-Agent).
Indicates the browser visibility.
Wait until the browser has finished loading, return true if browser is fully loaded, false if timedout (if timeout is passed).
Parameters:Navigate to an url
Parameters:Navigate("https://google.com/"); await WaitForLoading(); Navigate("https://9hits.com/", "https://google.com/");
Returns the maximum duration in seconds that the viewer will view your website.
Returns the total time in seconds that the viewer viewed your website.
Returns the maximum number of popups your site may be allowed to open, if the viewer is disabled popups by the owner, the return value will be 0
Returns the connection type of the viewer. Possible values are: system, http, socks4, socks5, ssh.
Get an image in base64 format based on its xpath.
Parameters:Solve captcha by 2Captcha service. If you want to use another provider that is similar with 2captcha, you can set the api endpoint to _2CaptchaServer.
Parameters://_2CaptchaServer = "http://a-similar-2captcha.com"; let captBase64 = await GetImageByXpath('//*[@id="CAPTCHA"]'); let result = await _2CaptchaSolve({ 'key' : '2CAPTCHA_API_KEY', //replace with your 2Captcha API Key 'method' : 'base64', 'json' : 1, 'body': captBase64 }); Log("Result is:", result.request); //Example Result: {status:1, request: VMXKDG, captchaId: 1241352612}
If you believe that captcha is resolved incorrectly, you can use this function to report it. However do not abuse.
Parameters:let captBase64 = await GetImageByXpath('//*[@id="CAPTCHA"]'); let result = await _2CaptchaSolve({ 'key' : '2CAPTCHA_API_KEY', //replace with your 2Captcha API Key 'method' : 'base64', 'json' : 1, 'body': captBase64 }); //do something... await _2CaptchaReportBad('2CAPTCHA_API_KEY', result.captchaId);
Solve captcha by anti-captcha service. If you want to use another provider that is similar with anti-captcha, you can set the api endpoint to AntiCaptchaServer.
Demo .
//AntiCaptchaServer = "http://a-similar-anti-captcha.com"; let image = await GetImageByXpath('//*[@id="captcha_one"]'); let result = await ACSolve({ "clientKey":"Your anti-captcha API Key", "task": { "type":"ImageToTextTask", "body":image, "phrase":false, "case":false, "numeric":false, "math":0, "minLength":0, "maxLength":0 } }, 150);Example Result:
{ "taskId":1234567, "errorId":0, "status":"ready", "solution": { "text":"deditur", "url":"http:\/\/61.39.233.233\/1\/147220556452507.jpg" }, "cost":"0.000700", "ip":"46.98.54.221", "createTime":1472205564, "endTime":1472205570, "solveCount":"0" }
If you believe that the image captcha is resolved incorrectly, you can use this function to report it. However do not abuse.
Parameters:let image = await GetImageByXpath('//*[@id="captcha_one"]'); let result = await ACSolve({ "clientKey":"Your anti-captcha API Key", "task": { "type":"ImageToTextTask", "body":image, "phrase":false, "case":false, "numeric":false, "math":0, "minLength":0, "maxLength":0 } }, 150); ... //do something | submit captcha... ... if(somehow you know that the captcha was incorrect) { ACReportIncorrectImage("Your anti-captcha API Key", result.taskId); }
If you believe that the reCaptcha is resolved incorrectly, you can use this function to report it. However do not abuse.
Parameters:var result = await ACSolve({ "clientKey": "Your anti-captcha API Key", "task": { "type":"NoCaptchaTaskProxyless", "websiteURL":"https://9hits.com", "websiteKey":"6LdPp08UAAAAADi4dE6frVDXCv2CgESTpcscb_LS" } }, 600); ... //do something | submit captcha... ... if(somehow you know that the reCaptcha was incorrect) { ACReportIncorrectRecaptcha("Your anti-captcha API Key", result.taskId); }
Try to execute recaptcha callback
Returns the number of opened tabs.
Simulate typing
Parameters:await Typing ("Hello 9Hits"); await Typing ("Hello 9Hits", 300, 500);
Change the browser size.
Parameters:Scroll the browser to the specified coordinates.
Parameters:Focusing on the specified tab, macros will be executed on the focused tab after this function call
Parameters:await WaitForLoading(); EvalScript('open("https://google.com")'); EvalScript('open("https://facebook.com")'); await Delay(2000); EvalScript('document.write("this is main tab")'); TabFocus(2); //focus to the 2nd tab await Delay(1000); EvalScript('document.write("this 2nd tab")'); TabFocus("facebook.com"); //focus to the tab which has url contains "facebook.com" await Delay(1000); EvalScript('document.write("this facebook tab")'); //focus to the first tab that does not contains facebook.com TabFocus("!facebook.com");
Simulate keydown event.
Parameters:Simulate keyup event.
Parameters:Simulate keychar event.
Parameters:Simulate keypress event.
Parameters:Simulate mouseclick event.
Parameters:Simulate mousemove event.
Parameters:await SendMouseWheel(0, -120); //scroll down 120px await Delay(3000); await SendMouseWheel(0, 120); //scroll up 120px
Close the browser immediately.
Make HTTP Request
Parameters:let test1 = await HttpRequest("http://google.com"); let test2 = await HttpRequest("http://google.com", "", {"post_data" : "xxx", "other_data": "yyy"}); let test3 = await HttpRequest("http://google.com", "", {"post_data" : "xxx", "other_data": "yyy"}, {"custom-header": "custom-value"});
Read and return the contents of a file as text
Parameters:let test = await ReadFile("C:\\test.txt"); Log(test);
Write text to a file
Parameters:await WriteFile("C:\\test.txt", "Hello"); await WriteFile("C:\\test.txt", "Hello", "append");
Returns the current path that 9Hits Traffic Bot is running
Returns the array of downloaded filenames
Check if the given file has been downloaded
Parameters:Set the files will be selected when you click to a Chose File button on a web-page.
Parameters:SetUploadFileOrFolder("C:\\test.txt"); SetUploadFileOrFolder("C:\\myfiles"); SetUploadFileOrFolder(["C:\\test_1.txt", "C:\\test_2.txt"]);
Feel free to request a new function here.
By using our site, you acknowledge that you have read and understood our Cookie Policy, Privacy Policy and our Terms of Service