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

eval argument does not work in the webshot() function #43

Closed
bulam opened this issue Aug 3, 2017 · 2 comments
Closed

eval argument does not work in the webshot() function #43

bulam opened this issue Aug 3, 2017 · 2 comments

Comments

@bulam
Copy link

bulam commented Aug 3, 2017

The eval argument doesn't work for running javascript in the webshot() function.

When I try the example cited in the documentation (code below), a screenshot is taken, but the username and password are not filled in. I have also tested writing other javascript outside of webshot and it functions as expected, but as soon as I put it in webshot, it stops working.

webshot("http://www.reddit.com/", "reddit-input.png",
  selector = c("#search", "#login_login-main"),
  eval = "casper.then(function() {
    // Check the remember me box
    this.click('#rem-login-main');
    // Enter username and password
    this.sendKeys('#login_login-main input[type=\"text\"]', 'my_username');
    this.sendKeys('#login_login-main input[type=\"password\"]', 'password');

    // Now click in the search box. This results in a box expanding below
    this.click('#search input[type=\"text\"]');
    // Wait 500ms
    this.wait(500);
  });"
)```
@wch wch closed this as completed in ed80cdd Aug 4, 2017
@bulam
Copy link
Author

bulam commented Aug 4, 2017

This is great. Thanks @wch !!

@aguy004
Copy link

aguy004 commented Sep 26, 2017

I'm trying to tailor this example for my own project.
Did you have a problem with the this.click commands?
I can get the sendkeys to work using this.sendKeys('input[name =searchString]', 'waitati');
but not the this.click. I am trying to make it click a button to compete the search.
Any help would be appreciated.

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

2 participants