Skip to content

Releases: xoFeulB/BlueFox

v0.5.5

15 Mar 03:22
2835b16
Compare
Choose a tag to compare

BlueFoxScript.runWorkspaceScript()

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  await blueFoxScript.runWorkspaceScript("/argument.js", ["A", "B", "C", "D"]);
})();

v0.5.4

14 Mar 19:40
dcdefa2
Compare
Choose a tag to compare

BlueFoxScript[tabId].getScreenshot()

(async () => {
  let Uint8Array_png_image = await tab.getScreenshot(
    `CSS Selector`,
    (config = {
      format: "png",
      captureBeyondViewport: true,
    })
  );
})();

v0.5.3

13 Mar 11:09
9ca6714
Compare
Choose a tag to compare

getEventListners()
getSelectors()

v0.5.2

11 Mar 14:26
622e119
Compare
Choose a tag to compare
Merge pull request #34 from xoFeulB/v0.5

_

v0.5.1

10 Mar 18:38
50f6307
Compare
Choose a tag to compare
async setUserAgentOverride(parameters) {
  // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setUserAgentOverride
}
async emulateNetworkConditions(parameters) {
  // https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-emulateNetworkConditions
}
async setCPUThrottlingRate(parameters) {
  // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setCPUThrottlingRate
}
async setDeviceMetricsOverride(parameters) {
  // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride
}
async setTimezoneOverride(parameters) {
  // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setTimezoneOverride
}

v0.5.0

10 Mar 16:35
8322c14
Compare
Choose a tag to compare

Scripting

Automate with javascript

Table of Contents

Global objects

  • log ... console.log
  • assert ... console.assert
  • await sleep
  • BlueFoxScript
  • BlueFoxJs

Scripting Reference

BlueFoxScript.runScript()

Run String:script

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  let script = await (
    await fetch("https://ooo.bluefox.ooo/BlueFoxDemo/js/confirm.js")
  ).text();
  window.alert(
    `Confirmed: ${(await blueFoxScript.runScript(script)).result.value}`
  );
})();

BlueFoxScript.runWorkspaceScript()

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  await blueFoxScript.runWorkspaceScript("/alert.js");
})();

BlueFoxScript.getWorkspaceFile()

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  let file = await blueFoxScript.getWorkspaceFile("/img/BlueFox.png");

  // Property
  file.name;
  file.type;
  file.blob;
  file.object;
})();

BlueFoxScript.tabs.info[n]

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  tab = await blueFoxScript.createWindow(
    "https://ooo.bluefox.ooo/BlueFoxDemo/8bit.html"
  );

  tab = await blueFoxScript.findTab(
    "https://ooo.bluefox.ooo/BlueFoxDemo/8bit.html"
  )[0];

  // Property
  tab.info;
  tab.responses;
  tab.keepResponses;
})();

BlueFoxScript[tabId].tails() ... Method chaining

(async () => {
  let tails = tab.tails({
    sleep: 100,
    dispatchEvents: [
      {
        option: {
          eventObject: "Event",
          eventType: "change",
          eventArgs: {
            bubbles: true,
          },
        },
      },
      {
        option: {
          eventObject: "Event",
          eventType: "input",
          eventArgs: {
            bubbles: true,
          },
        },
      },
    ],
  });
})();

.init()

(async () => {
  tails.init({ sleep: 100 });
})();

.target()

(async () => {
  tails.target(`CSS Selector or XPath`);
})();

.defined()

same as .target(`:is([data-testid="${UI Name}"],[bluefox-label="${UI Name}"],[aria-description="${UI Name}"],[aria-label="${UI Name}"])`)

(async () => {
  tails.defined(`UI Name`);
})();

.set()

(async () => {
  tails.set({
    property: {
      path: "value",
    },
    attribute: {
      key: "value",
    },
  });
})();

.setProperty()

(async () => {
  tails.setProperty({
    path: "value",
  });
})();

.setAttribute()

(async () => {
  tails.setAttribute({
    key: "value",
  });
})();

.push()

(async () => {
  tails.push({
    property: {
      path: "value",
    },
    attribute: {
      key: "value",
    },
  });
})();

.call()

(async () => {
  tails.call(`click`, null);
})();

.event()

(async () => {
  tails.event({
    eventObject: "path",
    eventType: "event type",
    eventArgs: "any",
  });
})();

.focus()

move into Shadow DOM, iframe

(async () => {
  tails.focus(`Property`, (reset = false));
})();

.capture()

(async () => {
  tails.capture(
    (selector = `CSS Selector or XPath`),
    (object = {
      fileName: "capture",
      format: "png",
      quality: 100,
    })
  );
})();

.key()

Argument Reference
https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent

(async () => {
  tails.key({
    type: "keyDown",
    windowsVirtualKeyCode: 65,
  });
})();

.open()

(async () => {
  tails.open("URL");
})();

.sleep()

sleep millisecond

(async () => {
  tails.sleep(1000);
})();

.file()

(async () => {
  tails.file([
    {
      name: "FileName",
      type: "MIME",
      blob: [...Uint8Array],
      object: "Uint8Array",
    },
  ]);
})();

.getProperties()

(async () => {
  let properties = await tails.getProperties(`CSS Selector or XPath`);
})();

.run()

run Tails

(async () => {
  await tails.run({ sleep: 100 });
})();

.runTillNextOnLoad()

run Tails and await till next window.onload

(async () => {
  await tails.runTillNextOnLoad({ sleep: 100 });
})();

BlueFoxScript[tabId].addEventListeners()

(async () => {
  let listener_info = await tab.addEventListeners(
    `[data-testid="bit-1"]`,
    "click",
    async (object) => {
      log(object);

      // Property
      object.event;
      object.properties;
      listener_info[0].uuid == object.event.uuid;
      listener_info[0].selector == object.event.target;
    }
  );
  // Property
  listener_info[0].uuid;
  listener_info[0].selector;
})();

BlueFoxScript[tabId].dispatchScript()

(async () => {
  await tab.dispatchScript(() => {
    window.alert("^.,.^ BlueFox");
  });
})();

BlueFoxScript[tabId].dispatchScriptTillTrue()

(async () => {
  await tab.dispatchScriptTillTrue(() => {
    return true;
  }, (max_polling = 5000));
})();

BlueFoxScript[tabId].dispatchAction()

run Tails

(async () => {
  await tab.dispatchAction(tails.tail);
})();

BlueFoxScript[tabId].captureScreenshot()

(async () => {
  let base64_png_image = await tab.captureScreenshot(
    (config = {
      format: "png",
      captureBeyondViewport: true,
    })
  );
})();

BlueFoxScript[tabId].close()

(async () => {
  await tab.close();
})();

BlueFoxScript[tabId].reload()

(async () => {
  await tab.reload();
})();

BlueFoxScript[tabId].cookie.get()

https://developer.chrome.com/docs/extensions/reference/api/cookies#method-getAll

(async () => {
  await tab.cookie.get({ domain: "domain" });
})();

BlueFoxScript[tabId].cookie.remove()

https://developer.chrome.com/docs/extensions/reference/api/cookies#method-remove

(async () => {
  await tab.cookie.remove({ name: "name" });
})();

BlueFoxScript[tabId].cookie.set()

https://developer.chrome.com/docs/extensions/reference/api/cookies#method-set

(async () => {
  await tab.cookie.set({ name: "name", value: "value" });
})();

Step by Step

1. Inside async function

(async () => {
  // Write your code here
})();

2. Initialize

(async () => {
  let blueFoxScript = await new BlueFoxScript();
})();

3. Open target window

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  let tab = await blueFoxScript.createWindow("https://www.google.com");
})();

4. Initialize tails

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  let tab = await blueFoxScript.createWindow("https://www.google.com");

  let tails = await tab.tails();
})();

5. Preparing tails

(async () => {
  let blueFoxScript = await new BlueFoxScript();

  let tab = await blueFoxScript.createWindow("https://www.google.com");

  let tails = await tab.tails();
  tails
    .target("textarea")
    .setProperty({ value: "^.,.^ BlueFox" })
    .target("[name='btnK'][tabindex='0']")
    .call("click", null);
})();

6. Run tails

<blue...

Read more

v0.4.9

09 Mar 07:28
4aedda6
Compare
Choose a tag to compare

CreateShortcut to Chrome and install BlueFox

Windows PowerShell

.\CreateShortcut-Chrome.ps1
$chrome_path = (
    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
    "C:\Program Files\Google\Chrome\Application\chrome.exe"
)
$chrome = $Args[0]

foreach ($path in $chrome_path) {
    if (Test-Path -Path $path) {
        $chrome = $path
        Write-Host ( -join ( "Chrome found in ", $chrome ))
    }
}

$root = Convert-Path .
$Desktop = [System.Environment]::GetFolderPath("Desktop")
$AppData = $env:APPDATA
$LocalAppData = $env:LOCALAPPDATA
$StartMenu = -join ( $AppData, "\Microsoft\Windows\Start Menu\Programs" )
$UserDataDir = -join ( $LocalAppData, "\BlueFoxEnterprise\Chrome")

if (Test-Path -Path $UserDataDir) {
    Write-Host "Folder already exists."
}
else {
    Write-Host "Folder does not exist."
    New-Item -Path $UserDataDir -ItemType Directory
}
Write-Host ( -join ( "UserData is in ", $UserDataDir ))

$shell = New-Object -ComObject WScript.Shell

$lnk = $shell.CreateShortcut( -join ( $StartMenu, "\Chrome-BlueFox.lnk" ) )
$lnk.TargetPath = $chrome
$lnk.Arguments = -join ( "https://ooo.bluefox.ooo/BlueFox/info/index.json", " --user-data-dir=", $UserDataDir , " --load-extension=", $root)
$lnk.IconLocation = -join ( $root, "\media\icons\icon.ico" )
$lnk.Save()
Write-Host ( -join ( "CreateShortcut in ", $StartMenu ))

$lnk = $shell.CreateShortcut( ".\Chrome-BlueFox.lnk"  )
$lnk.TargetPath = $chrome
$lnk.Arguments = -join ( "https://ooo.bluefox.ooo/BlueFox/info/index.json", " --user-data-dir=", $UserDataDir , " --load-extension=", $root)
$lnk.IconLocation = -join ( $root, "\media\icons\icon.ico" )
$lnk.Save()
Write-Host "CreateShortcut in current"

v0.4.8

09 Mar 04:42
8fe9fae
Compare
Choose a tag to compare

catch try catch

v0.4.7

09 Mar 03:38
97e8e75
Compare
Choose a tag to compare

Cookie

v0.4.6

09 Mar 03:13
f5a5abe
Compare
Choose a tag to compare
Merge pull request #26 from xoFeulB/v0.4

V0.4