Skip to content

strange java traceback when setting text input! #149

Closed

Description

@bubenkoff

Hi

i get this exception

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!

Activity

  1. ombre42 commented on Dec 11, 2012

    @ombre42
    Contributor

    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.

        def send_keys(self, *value):
            """Simulates typing into the element."""
            local_file = LocalFileDetector.is_local_file(*value)
            if local_file is not None:
                value = self._upload(local_file)
            ...

    see more at http://code.google.com/p/selenium/source/browse/trunk/py/selenium/webdriver/remote/webelement.py

  2. bubenkoff commented on Dec 11, 2012

    @bubenkoff
    Author

    but

    if file_path is '':
    return None

        try:
          if os.path.exists(file_path):
              return file_path
        except:
          pass
        return None
    

    from def is_local_file

    clearly says that it will return False, so should be not relevant here, right?

  3. ombre42 commented on Dec 11, 2012

    @ombre42
    Contributor

    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:

    ...
    if local_file is not None:
        raise Exception("local_file is '%s'" % local_file) # debug
        value = self._upload(local_file)
    ...
  4. bubenkoff commented on Dec 11, 2012

    @bubenkoff
    Author

    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

  5. ombre42 commented on Dec 27, 2012

    @ombre42
    Contributor

    Any update on this? Is os.path.exists() returning True for the user names you are trying to input?

  6. bubenkoff commented on Feb 15, 2013

    @bubenkoff
    Author

    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

  7. ombre42 commented on Jan 18, 2014

    @ombre42
    Contributor

    @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.

  8. bubenkoff commented on Jan 18, 2014

    @bubenkoff
    Author

    yes, that's solely selenium issue, thanks

    On 18 January 2014 09:45, Kevin Ormbrek notifications@github.com wrote:

    @bubenkoff https://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
    .

    Anatoly Bubenkov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions