Closed
Description
What happened?
In python, using send_keys to submit over 255 characters of text to the page will result in OSError: [Errno 36] File name too long
. Previous versions of Selenium (EG 4.8.0) would ignore this error because LocalFileDetector.is_local_file had an exception catch, which was removed by this MR #12253
How can we reproduce the issue?
from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
options=options)
driver.get("http://www.google.com")
driver.find_element(By.XPATH, "//textarea[@class='gLFyf']").send_keys(
"123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 "
"123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 "
"123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 "
"123456789 123456")
### Relevant log output
```shell
/src/project/venv310/bin/python /src/project/scratch/bug_demo.py
Traceback (most recent call last):
File "/src/project/scratch/bug_demo.py", line 10, in <module>
driver.find_element(By.XPATH, "//textarea[@class='gLFyf']").send_keys(
File "/src/project/venv310/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 219, in send_keys
local_files = list(
File "/src/project/venv310/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 221, in <lambda>
lambda keys_to_send: self.parent.file_detector.is_local_file(str(keys_to_send)),
File "/src/project/venv310/lib/python3.10/site-packages/selenium/webdriver/remote/file_detector.py", line 49, in is_local_file
return file_path if path.is_file() else None
File "/usr/lib/python3.10/pathlib.py", line 1322, in is_file
return S_ISREG(self.stat().st_mode)
File "/usr/lib/python3.10/pathlib.py", line 1097, in stat
return self._accessor.stat(self, follow_symlinks=follow_symlinks)
OSError: [Errno 36] File name too long: '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456'
Process finished with exit code 1
Operating System
Ubuntu 22.04
Selenium version
Python 3.10.12, Selenium 4.11.2
What are the browser(s) and version(s) where you see this issue?
Chrome: 115.0.5790.110
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver: 115.0.5790.102
Are you using Selenium Grid?
selenium/standalone-chrome:4.11.0-20230801