Skip to content

Instantly share code, notes, and snippets.

@AaronMT
Created October 31, 2023 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronMT/c1cdf57c556e8adb83f138eed952d39c to your computer and use it in GitHub Desktop.
Save AaronMT/c1cdf57c556e8adb83f138eed952d39c to your computer and use it in GitHub Desktop.
Appium (GeckoDriver) + PyTest Example
import pytest
from appium import webdriver
from appium.options.gecko import GeckoOptions
def generate_options():
common_caps = {
'browserName': 'MozillaFirefox',
'platformName': 'mac',
}
android_options = GeckoOptions().load_capabilities(common_caps)
android_options.firefox_options = {
'androidDeviceSerial': 'emulator-5554',
'androidPackage': 'org.mozilla.fenix.debug',
}
return [android_options]
@pytest.fixture(params=generate_options())
def driver(request):
driver = webdriver.Remote('http://127.0.0.1:4723', options=request.param)
yield driver
driver.quit()
class TimeoutError(Exception):
pass
def test_google(driver):
driver.get('https://google.com')
driver.get('http://duckduckgo.com')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment