proposed extension to the casper module: fetchTexts()

12 views
Skip to first unread message

Robert Poor

unread,
Dec 11, 2015, 4:26:15 PM12/11/15
to CasperJS
Esteemed CasperJS community:

As requested in the Contribution Guide, I've opened an issue to propose a 'casper.fetchTexts()' method so the community can read about it and comment on it: https://github.com/n1k0/casperjs/issues/1375.

In short, where the existing casper.fetchText() method will catenate the matched text into a single string, the proposed casper.fetchTexts() will return the a list of strings:

    casper.start('http://casperjs.readthedocs.org/en/latest/index.html', function() {
        this.echo(this.fetchText('h3'));
    }).run();    // => 'NavigationTable Of ContentsIndexThis PageQuick searchDonateNavigation'

    casper.start('http://casperjs.readthedocs.org/en/latest/index.html', function() {
        this.echo(this.fetchTexts('h3'));
    }).run();    // => ['Navigation', 'Table Of Contents', 'Index', 'This Page', 'Quick search', 'Donate', 'Navigation']


- rdp

Reply all
Reply to author
Forward
0 new messages