Giter Club home page Giter Club logo

Comments (6)

whymarrh avatar whymarrh commented on May 18, 2024

I'm not sure as to how PhantomJS handles sessions, but would it be possible to add a list (array) of JS filenames to the pa11y config file which can then be injected into the page before running the HTML_CodeSniffer?

from pa11y.

rowanmanning avatar rowanmanning commented on May 18, 2024

That's the kind of thing I was thinking yeah, there are a few unknowns though:

  • What would happen if the page/URL changes (e.g. if you submit a login form)?
  • Do the JS files need to be served through a web-server, or can we inject them into the Phantom browser from the file system?
  • Is there a simpler way to solve this problem (e.g. inject a cookie into the page)

from pa11y.

whymarrh avatar whymarrh commented on May 18, 2024

Picking at that last point, wget uses a --cookie-jar flag to pass along a textual file in the format originally used by Netscape's cookie.txt file. Maybe a flag like that would work? Or, the config file could hold an array of JSON object literals that would represent cookies which could be passed along one by one to phantom.addCookie? The latter seems doable.

from pa11y.

rowanmanning avatar rowanmanning commented on May 18, 2024

I like the idea of a JSON object in the config file. It'd be good to keep as much of the config as possible in the JSON

from pa11y.

whymarrh avatar whymarrh commented on May 18, 2024

How does this look for the config file?

{
    'cookies': [
        {
            'name': 'cookie-name',
            'value': 'cookie-value',
            'domain': 'localhost',
        },
        {
            'name': 'a-different-cookie-name',
            'value': 'cookie-value',
            'domain': 'localhost',
        }
    ]
}

These cookies could then be injected into the browser before loading the page.

from pa11y.

rowanmanning avatar rowanmanning commented on May 18, 2024

@whymarrh that looks great!

from pa11y.

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.