-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathBrowserStackAndroid.py
More file actions
32 lines (25 loc) · 1007 Bytes
/
BrowserStackAndroid.py
File metadata and controls
32 lines (25 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
userName = "BROWSERSTACK_USERNAME"
accessKey = "BROWSERSTACK_ACCESS_KEY"
desired_caps = {
"build": "Python 3 Android",
"device": "Samsung Galaxy S7",
"app": "bs://<hashed app-id>"
}
driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_caps)
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)
driver.quit()