Skip to content

tmobile/wdaproxy

 
 

Repository files navigation

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 file=@some.ipa 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

Packages

No packages published

Languages

  • Go 55.8%
  • HTML 43.9%
  • Makefile 0.3%