Closed reallymello closed 2 weeks ago
@reallymello Is this issue happening after you set the file detector?
"Error while running .sendKeysToElement() protocol action:" tells that this issue is coming from Selenium and on checking the selenium-webdriver
package, there's only one place keys.split
occurs (in the sendKeys implementation here).
So, this seems to be a bug on Selenium's side where because you are using a file detector, everything you send through sendKeys()
is considered to be a file first. Now, normally the text sent through sendKeys()
is not too big so a ENOENT
error is thrown while trying to read the file, which the file detector handles explicitly here. But, in case the text is too long, a different error ENAMETOOLONG
is thrown which the file detector does not handle, finally leading to the .split
function being used on an Array instead of a string (when the file detector throws an error, keys
remain an Array as before and does not change to a string here).
Also, this is not reproducible locally because a file detector only comes into effect when tests are being run on a remote selenium hub (BrowserStack here).
So, this issue would need to be raised in Selenium.
Your explanation makes sense, but what is strange and makes me question still is that the error in Nightwatch references the sendKeys command on a text entry field and not when setting the filepath on the file attachment input where presumably the file detector would have been used.
2024-10-23T21:33:37.7367083Z TimeoutError
2024-10-23T21:33:37.7368520Z An error occurred while running .sendKeys() command on <Element [name=@noteTextInput]>: keys.split is not a function
2024-10-23T21:33:37.7369525Z {"error":{},"status":-1,"value":null}
2024-10-23T21:33:37.7369801Z
2024-10-23T21:33:37.7370175Z Error location:
2024-10-23T21:33:37.7370717Z /nightwatch/nightwatch/tests/Automation/Functional/RegressionScripts/Features/FT713_FileNoteFoldering_B.ts:331
2024-10-23T21:33:37.7371554Z ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
2024-10-23T21:33:37.7371994Z 329 |
2024-10-23T21:33:37.7372379Z 330 | await desktopFileNotesPage
2024-10-23T21:33:37.7372913Z 331 | .sendKeys('@noteTextInput', [
2024-10-23T21:33:37.7381305Z 332 | 'On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accidentOn August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident On August 7th there was a accident reported in the Route 22 near the intersection of Milltown road. Claimant Jane Grey was the driver of Honda accord. She lost control and hit Edward Hunter who was driving a Toyota camry. Edward Hunter was hurt badly. Witness called 911. Deputy Sheriff Tony came to the scene. He found the back of the Toyota camry was damaged. Ambulance was called and Edward was hurried to the hospital. There was shattered glass all over the road. Traffic was diverted to due to the accident',
2024-10-23T21:33:37.7387055Z 333 | browser.Keys.TAB,
2024-10-23T21:33:37.7387638Z ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
2024-10-23T21:33:37.7387933Z
Actually, Selenium does not care if the sendKeys()
command is used with a text field or a file upload field. If a file detector is found, .sendKeys()
will always check first if any file by the same name as the text passed to .sendKeys()
exists on the system or not, and if it does then it will first upload that file to the remote machine and then send the keys to the input, otherwise, it will just send the keys without uploading anything.
It is then on the browser to check whether the input is a file input or a normal text input. And in case the input is a file input, it will check the remote system (local to the browser) for a file with the same name (which the .sendKeys()
command would have already uploaded if it existed) and carry on with the operation, otherwise, the browser won't check for any such file on the remote system and just submit the text.
The fix in Selenium is merged now and will be available in its next release: https://github.com/SeleniumHQ/selenium/pull/14663
This should be fixed now in Nightwatch v3.9.0
.
Description of the bug/issue
When I send a large text string (~4,101 characters) using setValue or sendKeys to a textArea element I expect the text to be entered into the control, but instead I receive error
Steps to reproduce
When running locally in Windows I don't see the error in my console, but I see it when observing both the normal and verbose logs in BrowserStack running the test on a linux agent.
This occurs when I run the lines of code in the sample test below
Sample test
Command to run
Verbose Output
Nightwatch Configuration
No response
Nightwatch.js Version
3.7
Node Version
20
Browser
Chrome
Operating System
Linux
Additional Information
No response