question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling element.sendKeys() seems to not send all the keys

See original GitHub issue

I am doing the following two tests:

   it("Should be able to populate the firstname field", function () {

        expect(capturePageModel.findFirstNameFieldValue()).toEqual("");
        capturePageModel.setFirstNameFieldValue("Adam");
        expect(capturePageModel.findFirstNameFieldValue()).toEqual("Adam");

    });

    it("Should be able to populate the lastname field", function () {
        expect(capturePageModel.findLastNameField()).toEqual("");
        capturePageModel.setLastNameFieldValue("Parrish");
        expect(capturePageModel.findLastNameField()).toEqual("Parrish")
    });

When I execute both tests in the same describe block I definitely am seeing the second test only send the “sh” value of the “Parrish” value I am passing in. Thus the test fails.

However each test runs fine by itself. I am attempting to use PageObjects to write a few documents on how this could work but curious if you have seen anything like this happen.

Simple example of my setter and getter functions in my PageObjects

this.setLastNameFieldValue = function( value ) {

    var lastNameElement = element(by.model('presubmitUser.lastName'))
    lastNameElement.sendKeys( value );

}

this.findLastNameField = function() {
    var firstNameElement = element(by.id('lastName'))
    return firstNameElement.getAttribute('value');
}

The first name field is identical to the last name field.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:56 (14 by maintainers)

github_iconTop GitHub Comments

22reactions
dodoshanticommented, Feb 23, 2016

another workaround: pass individual chars to sendKeys: 'blah'.split('').forEach((c) => element.sendKeys(c))

7reactions
svetozar02commented, Jun 1, 2016

We also only have this issue on jenkins and not locally…

Read more comments on GitHub >

github_iconTop Results From Across the Web

'sendKeys' are not working in Selenium WebDriver
Try clicking on the textbox before you send keys. It may be that you need to trigger an event on the field before...
Read more >
1771 - sendKeys() sometimes doesn't enter all the characters ...
Hi, Since upgrading to chrome driver 2.35 sendKeys() method is sending jumbled text to the text box which affecting our automation suite.
Read more >
sendKeys() not working in Selenium Webdriver - Tutorialspoint
If we encounter issues while working with the sendKeys method, then we can use the JavaScript Executor to input text within an edit...
Read more >
Selenium SendKeys : All You Need To Know - LambdaTest
In this article, we'll delve into how Selenium helps us pass values to text fields using the Selenium sendKeys() method.
Read more >
7. WebDriver API — Selenium Python Bindings 2 documentation
This can be caused by calling an operation on the Alert() class when an alert is ... Values are defined in Keys class....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found