Facebook WebDriverAgent Python Client Library (not official)
Not finished yet.
-
You need to start WebDriverAgent by yourself
Follow the instructions in https://github.com/facebook/WebDriverAgent
And start WDA with command
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 6' test -
Install python wda client
pip install --pre facebook-wda
Create a client
import wda
c = wda.Client('http://localhost:8100')
# Show status
print c.status()
# Press home button
c.home()Take screenshot
c.screenshot('screen.png')Open app
with c.session('com.apple.Health') as s:
print s.orientationSame as
s = c.session('com.apple.Health')
print s.orientation
s.close()Session operations
# One of <PORTRAIT | LANDSCAPE>
print s.orientation # expect PORTRAIT
# Get width and height
print s.window_size
# Simulate touch
s.tap(200, 200)
# Find elements
print s(text="Dashboard").exists
# Find second element, index from 0
print s(text="Dashboard")[1]
# Tap selected element
s(text="Dashboard", className='Button').tap()
# Set text
s(text="Name").set_text("Hello")
# Clear text
s(text="Name").clear_text()
# s.close() # kill app, no need to call in with| Name | Bundle ID |
|---|---|
| iMovie | com.apple.iMovie |
| Chrome | com.google.chrome.ios |
| Apple Store | com.apple.AppStore |
| Weather | com.apple.weather |
| Camera | com.apple.camera |
| iBooks | com.apple.iBooks |
| Health | com.apple.Health |
| Desktop | com.apple.springboard |