BOT TBN Macro (Automation Library)

rastof

Penny King
Original poster
admin
coder
veteran
old school
coldschool
Joined
Oct 8, 2010
Posts
3,604
Reaction score
7,695
Points
437
Location
World Wide Web
The biggest con is userscript cant manipulate the browser like TAB CLOSEALLOTHERS etc. This limits its application to only manipulating website code. :okay:

You're correct but when I use the browser APIs you'll be able to manipulate the browsers tabs. Right now I only have code to edit websites. It's going to be a 2 part library. The first phase is website manipulation and second is the browser.
 
  • Like
Reactions: cooluser

cor3

Member
member
Joined
Aug 14, 2015
Posts
366
Reaction score
328
Points
111
Age
79
rastof pardon my ignorance...

Isn't possible to implemente selenium thru js and userscript?
like a wrapper or something to make it reachable.

Or isn't selenium of any good for you?
 

rastof

Penny King
Original poster
admin
coder
veteran
old school
coldschool
Joined
Oct 8, 2010
Posts
3,604
Reaction score
7,695
Points
437
Location
World Wide Web
rastof pardon my ignorance...

Isn't possible to implemente selenium thru js and userscript?
like a wrapper or something to make it reachable.

Or isn't selenium of any good for you?

You're correct and it should work. The goal of the project is for people to create bots quickly without having to learn a lot. Selenium is advanced for most even I macro lol. But yeah this is made for the inexperienced users in mind.
 

delirious

Member
member
Joined
Jun 26, 2012
Posts
196
Reaction score
12
Points
140
Any further improvement on this?, be nice for survey auto completion!
 

csgommready

Senior
senior
member
Joined
Mar 13, 2016
Posts
927
Reaction score
362
Points
117
Location
algeria
how to delete special element like body > div.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-draggable.ui-resizable
 

Blaze

Member
member
Joined
Jun 28, 2014
Posts
493
Reaction score
122
Points
146
Location
Denmark
How to make the script generate random string within a textbox? Say you need to make it all automated?
If you can; is it possible to connect it to a database?

Thanks
 

Durja

Member
member
Joined
Jun 9, 2017
Posts
202
Reaction score
44
Points
31
Age
22
I had an hour to waste, and I thought I would make something for the TBN community. Keep in mind this is some early prototype shit. I hope this will inspire you lazy fuckers to contribute more and at the same time kill off uBot/iMacro spam. The goal of this project is to create a javascript library to automate web pages. More features will be added soon and if you have requests post below.

Prerequisites
Firefox & Greasemonkey or Chrome & Tampermonkey


Code Base
Code:
// ==UserScript==
// @name         TBN-Macro
// @namespace    https://thebot.net/
// @version      0.0.1
// @description  Web Automation.
// @author       Rastof
// @match        http://parsleyjs.org/doc/examples/simple.html
// @grant        none
// ==/UserScript==

(function() {
    "use strict";var Form=function(){function n(){function n(n,c){var t=document.querySelector(n);null!==t&&(t.value=c)}function c(n,c){var t=document.querySelector(n);null!==t&&(t.checked=c)}function t(n,c){var t=document.querySelector(n);null!==t&&(t.value=c)}function u(n){var c=document.querySelector(n);null!==c&&c.click()}function o(n){var c=document.querySelector(n);null!==c&&c.submit()}function e(n,c){if("function"==typeof c)for(var t in n)n.hasOwnProperty(t)&&c(t,n[t])}function r(n,c){"function"==typeof c&&n.forEach(function(n){c(n)})}return{fill:function(c){e(c,function(c,t){n(c,t)})},check:function(n){e(n,function(n,t){c(n,t)})},select:function(n){e(n,function(n,c){t(n,c)})},click:function(n){r(n,function(n){u(n)})},submit:function(n){o(n)}}}var c;return{create:function(){return c||(c=n()),c}}}(),Click=function(){function n(){function n(n){var c=document.querySelector(n);null!==c&&c.click()}function c(n,c){"function"==typeof c&&n.forEach(function(n){c(n)})}return{click:function(t){c(t,function(c){n(c)})}}}var c;return{create:function(){return c||(c=n()),c}}}();

    // Put your code below this line

})();


Finding The CSS Selector
Right click and inspect the element you want to target.
Zmm1CuS.png


The source code will be highlighted in blue. Right-click the blue line select copy and copy selector.
nBzFxpH.png


URL
Chage this line to the URL you want to automate.
Code:
// @match        http://parsleyjs.org/doc/examples/simple.html


Forms
Create a form object.
Code:
var form = Form.create();

To fill input fields. Provide a CSS selector and the value you want to fill in the form.
Code:
var formData = {
    '#demo-form > input:nth-child(2)': 'rastof',
    '#demo-form > input:nth-child(4)': '[email protected]',
    '#message': 'This is some random text to fill the text box.'
};

form.fill(formData);

To select a check box.
Code:
var checkBoxData = {
    '#hobby6': true,
    '#hobby4': true
};

form.check(checkBoxData);

To click a radio button.
Code:
var radioData = [
    '#genderF'
];

form.click(radioData);

Select a value from a menu.
Code:
var selectMenuData = {
    '#heard': 'net'
};

form.select(selectMenuData);


Links

Click a button or link. Create a link object.
Code:
var links = Click.create();


Click a link or button.
Code:
links.click(['#demo-form > input.btn.btn-default']);


Demo

http://parsleyjs.org/doc/examples/simple.html

Code:
// ==UserScript==
// @name         TBN-Macro
// @namespace    https://thebot.net/
// @version      0.0.1
// @description  Web Automation.
// @author       Rastof
// @match        http://parsleyjs.org/doc/examples/simple.html
// @grant        none
// ==/UserScript==

(function() {
    "use strict";var Form=function(){function n(){function n(n,c){var t=document.querySelector(n);null!==t&&(t.value=c)}function c(n,c){var t=document.querySelector(n);null!==t&&(t.checked=c)}function t(n,c){var t=document.querySelector(n);null!==t&&(t.value=c)}function u(n){var c=document.querySelector(n);null!==c&&c.click()}function o(n){var c=document.querySelector(n);null!==c&&c.submit()}function e(n,c){if("function"==typeof c)for(var t in n)n.hasOwnProperty(t)&&c(t,n[t])}function r(n,c){"function"==typeof c&&n.forEach(function(n){c(n)})}return{fill:function(c){e(c,function(c,t){n(c,t)})},check:function(n){e(n,function(n,t){c(n,t)})},select:function(n){e(n,function(n,c){t(n,c)})},click:function(n){r(n,function(n){u(n)})},submit:function(n){o(n)}}}var c;return{create:function(){return c||(c=n()),c}}}(),Click=function(){function n(){function n(n){var c=document.querySelector(n);null!==c&&c.click()}function c(n,c){"function"==typeof c&&n.forEach(function(n){c(n)})}return{click:function(t){c(t,function(c){n(c)})}}}var c;return{create:function(){return c||(c=n()),c}}}();

    // Put your code below this line


    // create form and click objects.
    var form = Form.create();
    var links = Click.create();

    // fill input fields
    form.fill({
        '#demo-form > input:nth-child(2)': 'rastof',
        '#demo-form > input:nth-child(4)': '[email protected]',
        '#message': 'This is some random text to fill the text box.'
    });

    // select check boxes
    form.check({
        '#hobby6': true,
        '#hobby4': true
    });

    // select a value from drop down menu
    form.select({
        '#heard': 'net'
    });

    // select a radio button
    form.click([
        '#genderF'
    ]);

    // submit form
    links.click(['#demo-form > input.btn.btn-default']);
})();

GXi8eJ3.png
Thank you for sharing :)
 

abcpoker

Member
member
Joined
Feb 9, 2016
Posts
133
Reaction score
24
Points
61
Great thread... Thank you very much for sharing :thumbs:
 

iEuphoria

Member
member
Joined
Apr 27, 2017
Posts
5
Reaction score
1
Points
75
Location
Everywhere
Website
blackcube.ai
Hey, I know this is old... I prefer Selenium too, as I'm do site development. Wanted to mention:
There's a very interesting GUI automation tool called Sikuli and SikuliX which may be useful! It basically automates using images. So it's much simpler! and you can program it in Python or Java (JVM languages). It has an IDE which makes it easy to generate code.

http://sikulix.com/ (Newer)

http://sikuli.org/ (original)

There's also another much newer project called Robot Framework:
https://robotframework.org/

https://en.wikipedia.org/wiki/Robot_Framework

Automation is the bread & butter of any bot master's Library. Hope this helps someone!