Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using x-ray-phantom inside of x-ray composition #8

Open
bdolly opened this issue Jul 7, 2015 · 0 comments
Open

Using x-ray-phantom inside of x-ray composition #8

bdolly opened this issue Jul 7, 2015 · 0 comments

Comments

@bdolly
Copy link

bdolly commented Jul 7, 2015

I'm new to x-ray and phantom, I'm trying to figure out how to use the .click() from Nightmare inside of a nested x-ray composition. The docs aren't super clear on how to integrate the phantom driver into x-ray's schema style. Below is a sample with some of the express code left out for brevity.

At the contact.email I need to paginate to that link then click .reply_options to open an menu to get values from.

 var express      = require('express'), 
        phantom     = require('x-ray-phantom'),
        Xray            = require('x-ray);

var x = Xray();

APP.get('/phantom-test', function(req, res) {
    x('url-to-scrape', '.content .row',
     [{
       cl_pid: '.row@data-pid',
       title:  '.hdrlnk',
       images: '.i@data-ids',
       desc:   x('.i@href','#postingbody'),
       posted: {
        datetime:  '.pl time@datetime',
        formatted: '.pl time@title'
      },
        contact:{
        email:x('.i@href', '.reply_options .mailapp@href') //PAGINATE TO i@href THEN CLICK ON .REPY_OPTIONS TO GET THE .MAILAPP@HREF VALUE FROM THAT MENU
      }     
     }]
    )
    .write()
    .pipe(res);
});

Any help would great, some examples of how to accomplish this, fuller docset, maybe I need to refactor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant