Giter Site home page Giter Site logo

Comments (4)

soulgalore avatar soulgalore commented on June 17, 2024 1

Hi @kluslulu sorry there's no good example for that in the documentation. It should be something like this:

const path = require('path');

 const result = await sitespeed.run({
      urls: [path.resolve('yourscriptingfile.js'), 
      multi: true,
      browsertime: {
     ....

Best
Peter

from browsertime.

soulgalore avatar soulgalore commented on June 17, 2024

Hi @kluslulu here's the documentation for different commands: https://www.sitespeed.io/documentation/sitespeed.io/scripting/

Then you also always run JavaScript directly in the browser using:
https://www.sitespeed.io/documentation/sitespeed.io/scripting/#run-javascript

Best
Peter

from browsertime.

kluslulu avatar kluslulu commented on June 17, 2024

Hi @soulgalore, thanks so much for your reply.

I saw these two documents,but they need to be executed through the command line or docker like this: "sitespeed.io login.js http://xxx --multi " or "sitespeed.io --preScript login http://xxx"

I want to use nodejs directly, like this(main.js):


async function run() {
  try {
    const result = await sitespeed.run({
      urls: ["https://xxxx"],  //  「How to login?😊」
      browsertime: {
        iterations: 1,
        connectivity: {
          profile: 'native',
          downstreamKbps: undefined,
          upstreamKbps: undefined,
          latency: undefined,
          engine: 'external'
        },
        browser: 'chrome'
      }
    });
    console.log(result);
  } catch (e) {
    console.error(e);
  }
}

run();

Then, getting the result by executing the node command “node main.js” instead of ‘sitespeed.io xxx’
What should I do for login if I want to use node command?

I try to see the source code, but did not find any solutions:
image

I'm not sure if I describe the problem clearly, my English is so poor😭~
Thanks very much again~

from browsertime.

kluslulu avatar kluslulu commented on June 17, 2024

Hi @soulgalore :thanks for your reply 😊

I tried this and it worked ! This is so helpful to me!

Thanks very much~

from browsertime.

Related Issues (20)

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.