8000 push a zip file to my Android device in Appium · Issue #268 · appium/python-client · GitHub
[go: up one dir, main page]

Skip to content

push a zip file to my Android device in Appium #268

@Ucoon

Description

@Ucoon

The problem

is there any way that pushing a zip file to my Android device? When using push_file() I found that it can push file such as text, but except zip file. I use python to write my scripts.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.9.0
  • Desktop OS/version used to run Appium: Ubuntu 18.04
  • Node.js version (unless using Appium.app|exe): v8.12.0
  • Mobile platform/version under test: Android 5.0

This is my code:

try:
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
except Exception as e:
print(("WebDriverException Error : ", e))

with open('E:\\myupdate_318.zip', 'rb') as zip_file:
    data = zip_file.read()
driver.push_file('/storage/sdcard1/myupdate.zip', data.encode('base64'))
zip_file.close()  

This is server log:

Traceback (most recent call last): File "/home/user/Project/Appium/AutoInstallSoftWare/AutoInstallSoftWare.py", line 30, in test_unintall_old_package self.driver.push_file('/storage/sdcard1/myupdate.zip', data.encode('base64')) AttributeError: 'bytes' object has no attribute 'encode'

What should I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0