GithubHelp home page GithubHelp logo

browser-automation / cba Goto Github PK

View Code? Open in Web Editor NEW
103.0 103.0 16.0 551 KB

Chromium Browser Automation (extension for chrome browser automation).

Home Page: https://chrome-automation.com

License: GNU General Public License v3.0

HTML 2.98% JavaScript 95.34% CSS 1.68%
automation chrome-automation webextension

cba's People

Contributors

manvel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cba's Issues

Move timer action input from second to first item

Currently timer actions looks like this:

{
   type: "timer",
   inputs: ["Please enter the time in milliseconds", "1000"],
   info: "Please enter the time in milliseconds"
}

Main input in the example is "1000", while the other input is obsolete and needs to be replaced with info in UI by #44 .

copy html vs content

Copy action currently is copying the HTML inside the element, question is if we need to change that to the textContent, in general we might want to either introduce copying the textContent in addition or instead copying HTML.

Recording anchor click saves redirection, maybe shouldn't?

Background

Currently the we take href of the anchor and create a redirection, that might have been because previously browsers weren't handling click on the anchor. With #3 we ensured that redirection works fine when clicking anchor, considering that there doesn't seem to be a reason why we need to register redirect, maybe we can use generic click actions.

What to change

If the anchor is redirecting to another page, record submit-click action, otherwise click.

Use message passing instead of getBackgroundPage() for play/rec/stop

Background

Currently we stopButtonClick(), recordButtonClick() and playButtonClick() are adde to the global variable in background in order to make it accessible from other pages. Ideally we would use message passing instead, but the problem is that we need to find a way to test it from the puppeteer, while in puppeteer running chrome.runtime.sendMessage in background page result in Could not establish connection. Receiving end does not exist error, as it's trying to send message in the same frame we are listening(in background).

What to change

Find a way how to use message passing for stopButtonClick(), recordButtonClick() and playButtonClick() and same time be able to test in puppeteer.

Sandboxing bg-inject

Background

bg-inject action is being executed in the extension context, we should move it into Sandboxed pages if possible.

What to change

Ensure that bg-inject can be executed in a sandbox page.

Migrate windows.storage to the browser.locale.storage

From:

{"group0":
  { "name":"group0",
    "level":"0",
    "parent":"",
    "isLeaf":false,
    "expanded":true,
    "loaded":true,
    "projects":
      [{ "action":
          [{"data":
            "#SIvCob",
            "evType":"copy",
            "newValue":""
            },
            { "data":".gLFyf.gsfi",
              "evType":"change",
              "newValue":"<$clipboard=copy>"
            },
            { "data":"alert(\"Hello World\");",
              "evType":"inject","newValue":"","name":"alert"
            }
          ],
        "name":"project",
        "level":"1",
        "isLeaf":true,
        "expanded":false,
        "loaded":true
        }
        ...

To:

[
  {
    "data": {
      "type": "group"
    },
    "text": "group0",
    "subItems": [
      {
        "data": {
          "type": "project"
          },
        "text": "project0"
      }
    ]
  }
]

clipboard vs cba.clipboard

Previously we use clipboard as a global variable in the background, but now we have introduced cba object, which we are mostly might use instead, the question is if we would like to continue supporting clipboard variable in the bg-inject action, or make sense start switching to cba.clipboard.

example usage:

sendBgInstruction = false; // Stop workflow of the CBA
chrome.windows.create({ url: clipboard["scrAlias"]}, function(){
sendInstruction(); // Continue with CBA workflow
});

Update: Decision was made to support legacy clipboard instead, as we can't maintain two objects easily.

Find better naming for DB items

Background

DB

"collections" - Contains groups, groups has sub_items(projects) and each project has actions.
"predefinedActions" - Custom actions as seen in Functions table
"tab" - Remember which tab was opened last

The questionable namings are: "collections" and "predefinedActions", should we keep those or find better naming?

Actions

Currently actions are represented with current fields:

  • data - Query, code or redirection link, comments.
  • type - Action type
  • value - New input value, timer amount.

What to change

rename:

  • collections -> projects
  • predefinedActions -> customActions

Reorganize actions:

  • actions
    • id
    • type (string)
    • inputs (array)
    • info (string)

Introduce warning for the bg-inject action

Background

bg-inject is quite powerful tool and user should ensure he that is not executing any evil script.

What to change

Introduce a warning for the projects that have bg-inject action so users never try executing any 3-rd party script they don't trust.

Ready function as AJAX alternative

We used to have ready function below, we might need to introduce an alternative to this.

function requestService(type, url, data) {
	$.ajax({
		type : type,
		url : url,
		data : data
	}).done(function(msg) {
		cba.clipboard["serviceAnswer"] = msg;
		sendInstruction();
	});
}

Make use of the info data in actions

Background

With #40 we have introduced info for action which suppose to be replace misused inputs as information text.

What to change

Introduce a UI information element which suppose to hint users how to use specific actions using data from the "info".

Recording sibling path is wrong

Current getPath method which suppose to get the path to the target item, only get's tree-path, consider example:

<body>
  <input type="submit" />
  <input type="image" />
  <input type="text" />
  <input type="password" />
</body>

Clicking any input item will result in path being body div INPUT

Rename submit-click into something more meaningful

Background

submit-click action in comparison to the regular click waits for an update event to be fired by the tab in order to continue the execution flow, even though it's useful when clicking on submit buttons which redirect you to another page, but the name itself making the action unintuitive.

Suggestions:

  • click-update
  • click-wait-update

Changes to be addressed in the website

Background

While rewriting the extension we have deprecated few methods, but yet keeping backwards compatibility, this issue is for tracking those and addressing in the website.

Deprecated method with backwards compatibility

sendBgInstruction and sendInstruction() -> Use async/await instead.

Action changes

copy -> copy-html - copies innerHTML.
copy -> copies textContent
submit-click -> click-update

Change event is not fired

When using change event it's expected that the event is fired, while it's not necessarily true as we are using Jquery's .change() method, which might only work with Jquery?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.