|
| 1 | +Appium Python Client Plan |
| 2 | +========================= |
| 3 | + |
| 4 | +This library will be a simple extension of the official Python bindings, through |
| 5 | +subclassing, to add the new methods. I would like to maintain the same package |
| 6 | +structure, so that switching to the Appium library would be a matter of changing |
| 7 | +the import. |
| 8 | + |
| 9 | +The official client allows for three ways to interact with the server: with the |
| 10 | +`selenium` class, with the `webdriver.Remote` class, and with specific browser |
| 11 | +classes, which subclass `webdriver.Remote` in `webdriver.*` classes. It seems |
| 12 | +like we would not need to update the browser classes for our use case, and the |
| 13 | +first is for RC, which we don't support. Thus we can subclass the official |
| 14 | +`webdriver.Remote` classes and add the new methods. Otherwise we would need to |
| 15 | +use composition, since we have to change the base class and subclasses. |
| 16 | + |
| 17 | +Usage will remain as it currently is, using the first two methods from above, |
| 18 | +other than importing from Appium: |
| 19 | + |
| 20 | +```python |
| 21 | +from appium import webdriver |
| 22 | + |
| 23 | +desired_caps = {} |
| 24 | +# ... |
| 25 | + |
| 26 | +driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) |
| 27 | + |
| 28 | +print driver.get_window_size() |
| 29 | +elem = driver.find_element_by_name('Graphics') |
| 30 | +elem.click() |
| 31 | +driver.quit() |
| 32 | +``` |
| 33 | + |
| 34 | +As Selenium catches up, the methods can be seemlessly removed from the Appium |
| 35 | +client. Any methods outside of the spec can remain and be used without issue, |
| 36 | +should the user choose. |
0 commit comments