diff --git a/android/browserstack_sample.py b/android/browserstack_sample.py index 1dab22b..b24b0c9 100644 --- a/android/browserstack_sample.py +++ b/android/browserstack_sample.py @@ -1,47 +1,12 @@ from appium import webdriver -from appium.webdriver.common.mobileby import MobileBy -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -import time - -desired_cap = { - # Set your access credentials - "browserstack.user" : "YOUR_USERNAME", - "browserstack.key" : "YOUR_ACCESS_KEY", - - # Set URL of the application under test - "app" : "bs://", - - # Specify device and os_version for testing - "device" : "Google Pixel 3", - "os_version" : "9.0", - - # Set other BrowserStack capabilities - "project" : "First Python project", - "build" : "browserstack-build-1", - "name" : "first_test" -} - -# Initialize the remote Webdriver using BrowserStack remote URL -# and desired capabilities defined above -driver = webdriver.Remote( - command_executor="http://hub-cloud.browserstack.com/wd/hub", - desired_capabilities=desired_cap +from appium.webdriver.common.appiumby import AppiumBy +desired_caps = dict( + platformName='Android', + platformVersion='10', + automationName='uiautomator2', + deviceName='Android Emulator', + app=PATH('../../../apps/selendroid-test-app.apk') ) - -# Test case for the BrowserStack sample Android app. -# If you have uploaded your app, update the test case here. -search_element = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search Wikipedia")) -) -search_element.click() -search_input = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) -) -search_input.send_keys("BrowserStack") -time.sleep(5) -search_results = driver.find_elements_by_class_name("android.widget.TextView") -assert(len(search_results) > 0) - -# Invoke driver.quit() after the test is done to indicate that the test is completed. -driver.quit() +self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) +el = self.driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='item') +el.click()