GithubHelp home page GithubHelp logo

Comments (4)

TASnomad avatar TASnomad commented on May 22, 2024

Hi @man0l,

Could you add between your await tab.fill() and await tab.screenshot() a call of await tab.wait(5000) ?

After running some test with the given code, i faced to a captcha (after calling await tab.wait(5000)).

Could you tell me, if you got the same result with this ?

Regards,

Martin B.

from nickjs.

man0l avatar man0l commented on May 22, 2024

You're right, @TASnomad, I get captcha!

Thank you for your reference!

This means the cookies are not set correctly and the fill() method works correctly :)

I have similar script in casperjs and when I enabled the cookies, I was able to log-in.

I am new with headless google chrome, how can I pass the cookies correctly?
When I dump the result from nick.getallCookies() it gives me this:

Promise {
  _bitField: 0,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined }

from nickjs.

TASnomad avatar TASnomad commented on May 22, 2024

@man0l , If you use the current version of Nickjs you can call nick.setCookie() to set a cookie in chrome headless.

The functions setCookies() and getAllCookies() return a Promise object, that's why in your trace, you get a Promise object and not the expected result. :)

setCookies() takes an object which looks like:

{
  name: 'cookie name',
  value: 'value cookie',
  domain: '.website.domain'
}

And code snippets could look like the follow examples:

try {
  await nick.setCookie({name: 'cookie name', value: 'value cookie', domain: '.website.domain'})
} catch (e) {
  console.log(`Error:`, e)
}

or :

await nick.setCookie({name: 'cookie name', value: 'value cookie', domain: '.website.domain'})
.then(() => {})
.catch((err) => {})

from nickjs.

man0l avatar man0l commented on May 22, 2024

Thank you for your reply, Tas!
I've managed to login with real pre-set cookies.

Regards,
Manol.

from nickjs.

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.