Giter VIP home page Giter VIP logo

wdaproxy's Introduction

wdaproxy

Powered By: GoReleaser

Make WebDriverAgent more powerful.

Platform

Limited in Mac

Features

  • Launch iproxy when start. Listen on 0.0.0.0 instead of localhost
  • Create http proxy for WDA server
  • add udid into GET /status
  • forward all url starts with /origin/<url> to /<url>
  • Add the missing Index page
  • Support Package management API
  • Support launch WDA
  • iOS device remote control
  • Support Appium Desktop (Beta)

Installl

$ brew install openatx/tap/wdaproxy

Usage

Simple run

$ wdaproxy -p 8100 -u $UDID

Run with WDA

$ wdaproxy -W ../WebDriverAgent

For more run wdaproxy -h

Strong recommended use python facebook-wda to write tests. But if you have to use appium. Just keep reading.

Simulate appium server

Since WDA implements WebDriver protocol. Even through many API not implemented. But it still works. wdaproxy implemented a few api listed bellow.

  • wdaproxy "/wd/hubs/sessions"
  • wdaproxy "/wd/hubs/session/$sessionId/window/current/size"

Launch wdaproxy with command wdaproxy -p 8100 -u $UDID

Here is sample Python-Appium-Client code.

from appium import webdriver
import time

driver = webdriver.Remote("http://127.0.0.1:8100/wd/hub", {"bundleId": "com.apple.Preferences"})

def wait_element(xpath, timeout=10):
    print("Wait ELEMENT", xpath)
    deadline = time.time() + timeout
    while time.time() <= deadline:
        el = driver.find_element_by_xpath(xpath)
        if el:
            return el
        time.sleep(.2)
    raise RuntimeError("Element for " + xpath + " not found")

wait_element('//XCUIElementTypeCell[@name="蓝牙"]').click()

Not working well code

driver.background_app(3)
driver.implicitly_wait(30)
driver.get_window_rect()
# many a lot.

Extended API

Package install

$ curl -X POST -F [email protected] http://localhost:8100/api/v1/packages
$ curl -X POST -F url="http://somehost.com/some.ipa" http://localhost:8100/api/v1/packages

Package uninstall

$ curl -X DELETE http://localhost:8100/api/v1/packages/${BUNDLE_ID}

Package list (parse from ideviceinstaller -l)

$ curl -X GET http://localhost:8100/api/v1/packages

For developer

First checkout this repository

git clone https://github.com/openatx/wdaproxy $GOPATH/src/github.com/openatx/wdaproxy
cd $GOPATH/src/github.com/openatx/wdaproxy

Update golang vendor

brew install glide
glide up

Package web resources into binary

go generate ./web
go build -tags vfs

LICENSE

Under MIT

wdaproxy's People

Contributors

codeskyblue avatar caarlos0 avatar jorinvo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.