You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
strange java traceback when setting text input! #149
17:04:55.637 WARN - Exception thrown
java.util.zip.ZipException: invalid stored block lengths
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:163)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:109)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:87)
at org.openqa.selenium.io.Zip.unzip(Zip.java:145)
at org.openqa.selenium.io.Zip.unzip(Zip.java:123)
at org.openqa.selenium.remote.server.handler.UploadFile.call(UploadFile.java:44)
at org.openqa.selenium.remote.server.handler.UploadFile.call(UploadFile.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:150)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
17:04:55.652 WARN - Exception: invalid stored block lengths
when trying to
Input Text id_username ${user}
when user is a string doublechecked that
and what's really strange, if i change this to:
Input Text id_username '${user}'
it passes ok, but of course sets wrong field value!
Input Text uses send_keys, which is also used to choose a file for an input element with type="file". Looking at the code Selenium does not appear to check that the target element is even appropriate for an upload, it merely checks that the text is also a valid path to a local file. The value you are using for ${user} must also be also be the path to a local file. Not sure why that's leading to an exception, but the problem is that it is trying to upload a file at an inappropriate time. I am not sure what to do in this scenario, but by understanding the problem, maybe you will.
defsend_keys(self, *value):
"""Simulates typing into the element."""local_file=LocalFileDetector.is_local_file(*value)
iflocal_fileisnotNone:
value=self._upload(local_file)
...
It would seem so. What is the value for ${user} that is triggering this error? I would alter Selenium's source code to trace this issue further (don't forget to restore later). Something like this:
...
iflocal_fileisnotNone:
raiseException("local_file is '%s'"%local_file) # debugvalue=self._upload(local_file)
...
Ok thanks for the suggestion, i will check that by such change
but basically value of ${user} is just string, and it looks, it doesn't 'like' ANY value
Sorry for delay, i debugged that, and the local_file is the string what i try to set by Input Text
BUT the value of it was an existing path's part
class LocalFileDetector(object):
@classmethod
def is_local_file(cls, *keys):
file_path = ''
typing = []
for val in keys:
if isinstance(val, Keys):
typing.append(val)
elif isinstance(val, int):
val = str(val)
for i in range(len(val)):
typing.append(val[i])
else:
for i in range(len(val)):
typing.append(val[i])
file_path = ''.join(typing)
if file_path is '':
return None
try:
if os.path.exists(file_path):
return file_path
except:
pass
return None
so it passed this check
the fix should be in checking abspath, not relative path
@bubenkoff A change like checking absolute path instead of relative path would have to be implemented upstream in the Selenium project. Please submit an issue there as it does not make sense to make the change to Selenium2Library.
@bubenkoffhttps://github.com/bubenkoff A change like checking absolute
path instead of relative path would have to be implemented upstream in the
Selenium project. Please submit an issue therehttps://code.google.com/p/selenium/issues/listas it does not make sense to make the change to Selenium2Library.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/149#issuecomment-32677508
.
Activity
ombre42 commentedon Dec 11, 2012
Input Text uses send_keys, which is also used to choose a file for an input element with type="file". Looking at the code Selenium does not appear to check that the target element is even appropriate for an upload, it merely checks that the text is also a valid path to a local file. The value you are using for ${user} must also be also be the path to a local file. Not sure why that's leading to an exception, but the problem is that it is trying to upload a file at an inappropriate time. I am not sure what to do in this scenario, but by understanding the problem, maybe you will.
see more at http://code.google.com/p/selenium/source/browse/trunk/py/selenium/webdriver/remote/webelement.py
bubenkoff commentedon Dec 11, 2012
but
if file_path is '':
return None
from def is_local_file
clearly says that it will return False, so should be not relevant here, right?
ombre42 commentedon Dec 11, 2012
It would seem so. What is the value for ${user} that is triggering this error? I would alter Selenium's source code to trace this issue further (don't forget to restore later). Something like this:
bubenkoff commentedon Dec 11, 2012
Ok thanks for the suggestion, i will check that by such change
but basically value of ${user} is just string, and it looks, it doesn't 'like' ANY value
ombre42 commentedon Dec 27, 2012
Any update on this? Is os.path.exists() returning True for the user names you are trying to input?
bubenkoff commentedon Feb 15, 2013
Sorry for delay, i debugged that, and the local_file is the string what i try to set by Input Text
BUT the value of it was an existing path's part
class LocalFileDetector(object):
so it passed this check
the fix should be in checking abspath, not relative path
ombre42 commentedon Jan 18, 2014
@bubenkoff A change like checking absolute path instead of relative path would have to be implemented upstream in the Selenium project. Please submit an issue there as it does not make sense to make the change to Selenium2Library.
bubenkoff commentedon Jan 18, 2014
yes, that's solely selenium issue, thanks
On 18 January 2014 09:45, Kevin Ormbrek notifications@github.com wrote:
Anatoly Bubenkov