JavaScript Why is sendKeys() not functioning properly in casperJS

I am writing an automation script to sign into draftkings.com. I am using sendKeys() to add my login credentials to the required fields. The first use of sendKeys() is for the username field which has the ID "Username". This will actually put my username into the field. The second use is for the password field with the ID "Password". However, this puts the desired text for this field into the username field. Am I missing something?

var casper = require('casper').create({
loadImages:false,
verbose: true,
logLevel: 'debug'
});

//set browser user agent
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');

//Open URL
casper.start('https://draftkings.com');

casper.then(function() {
    this.clickLabel('Sign-in', 'a');
});

casper.then(function() {
    this.sendKeys('#Username', 'xxxx');
    this.sendKeys('#Password', 'xxxx');
    this.click('a[data-signin-submit="1"]');

});

casper.then(function() {
    this.capture('test67_failed.png');
});
casper.run();

UPDATE:

I was unable to figure out why sendKeys was not working properly. I ended up just using this.evaluate() to enter the values into the fields with document.querySelector().

NEW ISSUE:

I can see in the console output that 'a[data-signin-submit="1"]' is being clicked and that the http request is being sent, but it is not actually logging me it. I am using phantomJS 2.0.0 so it is not an ssl issue though I tried that already. If my credentials were the capture would show that.

Answer:1

I have a simple react component to which I want to add a simple math function named doMath that uses property values. class MyClass extends Component { constructor( props ) { super( ......

I have a simple react component to which I want to add a simple math function named doMath that uses property values. class MyClass extends Component { constructor( props ) { super( ......

  1. react component where to fetch data
  2. react component
  3. react component library
  4. react component did update
  5. react component did mount
  6. react component example
  7. react component constructor
  8. react component props
  9. react component state
  10. react component will receive props
  11. react component will mount
  12. react component lifecycle methods
  13. react component vs purecomponent
  14. react component will update
  15. react component style
  16. react component function
  17. react component unmount
  18. react component typescript
  19. react component class
  20. react component will unmount

I'm creating a 12 days of Christmas javascript program and when I print out the statement it keeps repeating the statement. Can you give me any suggestions on how to fix this and get the program to ...

I'm creating a 12 days of Christmas javascript program and when I print out the statement it keeps repeating the statement. Can you give me any suggestions on how to fix this and get the program to ...

I would expect the following code to create an element which contains a div with the text "Hi" in it. The element appears in the inspector, but no text is visible on the screen. When I change the ...

I would expect the following code to create an element which contains a div with the text "Hi" in it. The element appears in the inspector, but no text is visible on the screen. When I change the ...

I have HTML like below <ul id="tabStripSecondaryElements" class="k-tabstrip-items k-reset" data-role="tabstrip" style="margin-left: 37px; margin-right: 40px;" role="tablist" aria-activedescendant="...

I have HTML like below <ul id="tabStripSecondaryElements" class="k-tabstrip-items k-reset" data-role="tabstrip" style="margin-left: 37px; margin-right: 40px;" role="tablist" aria-activedescendant="...

  1. find inner element jquery
  2. find inner element javascript
  3. find inner element by id jquery
  4. find element by inner text
  5. find element by inner text selenium
  6. find element by innerhtml
  7. find element by innertext javascript
  8. find element by inner text jquery
  9. selenium find element by innerhtml
  10. selenium find inner element
  11. jquery find inner element by class
  12. js find inner element
  13. css find inner element
  14. jest find inner element
  15. jquery find element by innerhtml
  16. js find element by inner text
  17. xpath find element by inner text
  18. how to find inner element