Calling element.sendKeys() seems to not send all the keys
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.
@hiteshAneja thanks for the info. In our case we were not using any modifier keys
same issue,sendkeys typing first character only. using mocha 2.4.5 in windows 8.1 var emailTxt = driver.findElement(webdriver.By.name('Email')); driver.wait(emailTxt,10000); emailTxt.sendKeys("testing");
Hi, I am encountering the same issue as described in this post:
Aaron-Hartwig commented on Dec 30, 2014 Having issues with sendKeys() where 5 is being treated as a backspace and 6 just terminates the process of sending keys to the input all together. Ex) elem.sendKeys(58801) would yield 8801 in the input elem.sendKeys(85801) would yield 801 in the input elem.sendKeys(88601) would yield 88 in the input
This is only happening when I run the tests from Jenkins, and does not occur when running on my local machine. What is a possible solution to this? Could it be something related to the Locale settings?
We also only have this issue on jenkins and not locally...
I'm seeing this issue with the Microsoft Web driver (v 10586) on Edge - exactly the same test passes using Chrome driver. Windows 10 machine, Protractor Javascript.
For example, if I sendKeys("ABCDEFGHIJ") to an input text box, only some of the chars appear.
Still exists. Site: http://maxcabrera.com/code/todo-list/ Protractor - 4.0.10 [15:53:15] I/status - selenium standalone version available: 2.53.1 [default] [15:53:15] I/status - chromedriver version available: 2.25 [default] [15:53:15] I/status - geckodriver version available: v0.11.1 [default] [15:53:15] I/status - android-sdk is not present [15:53:15] I/status - appium is not present NodeJS - 7
Test:
it('should create new note', function () {
browser.get(URL)
let webelement = $('input.enter-todo')
webelement.clear()
webelement.sendKeys('HHHHHHHHHHHHHHH')
browser.sleep(2000)
webelement.submit()
let notes = $$('todo-list .small-12')
browser.sleep(2000)
//expect(notes.getText()).not.toContain('New Shiny note')
expect(notes.getText()).toContain('HHHHHHHHHHHHHHH')
})
I think that the issue might be related to keyup / keydown triggers. I got around the issue by introducing a helper function with a tiny delay after each character:
function controlledInsert( elm, txt, delay ) {
for (var i = 0, len = txt.length; i < len; i++) {
elm.sendKeys( txt[ i ] );
browser.driver.sleep( delay );
}
elm.sendKeys(protractor.Key.NULL);
}
I am also facing the same issue while testing mobile App but strange thing is that it is working on other pages correctly only on particular page it is behaving differently.
Found similar kind of issue when I upgraded my chrome to v57
I discovered keys like "@" and "." are not sent. Switching browser from Chrome to Firefox fixes the issue. This seems not related though, as alphanumerical input is still sent properly (string lenght does not matter).
If it's helpful to others coming across this, I had this problem where sendKeys would consistently skip some characters. An ng-change that I have on the element that updates another element's value on the page (but does not change focus) caused the issue. Removing that ng-change fixed it. I need the ng-change so I used @dodoshanti 's 'blah'.split('').forEach((c) => element.sendKeys(c)) which fixed it for me (likely should actually do a .then if possible after each sendKeys(char) to make sure but works for me w/o it).
Even I was facing the same problem. What i changed was instaed of using sendkeys i used setvalue.
Setvalue will be active when you use android element instead of web or mobile elemnt
@kuiro5 thanks a ton your solution work for me :D
I have a text with . and @ I have to split them up [email protected]
await driver.elementByAccessibilityId('textUserName').sendKeys('[email protected]') textfield will show [email protected] I have to split them up in the code like this:
await driver.elementByAccessibilityId('textUserName').sendKeys('lay'); await driver.elementByAccessibilityId('textUserName').sendKeys('.mui'); await driver.elementByAccessibilityId('textUserName').sendKeys('[email protected]');
also I am not able to clear the textfield any one has any idea how I can clear the textfieldawait driver.elementByAccessibilityId('textUserName').clear() didn't work for me