Created
October 31, 2023 18:06
-
-
Save AaronMT/c1cdf57c556e8adb83f138eed952d39c to your computer and use it in GitHub Desktop.
Appium (GeckoDriver) + PyTest Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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