I am setting up my environment for automation using browserstack. I tried to implement the following code based on their instructions:
from Appium import webdriver
enter code here`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 = "cathytest1"
accessKey = "5u8P4kxrPdw3bCDPtyCU"
desired_caps = {
"build": "Python Android",
"device": "Samsung Galaxy S8 Plus",
"app": "bs://fa77cdc35c9dea891b543c3ab6bf2897b300e229"
}
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()
But I got the following error:
Traceback (most recent call last):
File "/Applications/Eclipse.app/Contents/MacOS/C:\EclipseWorkspaces\csse120/Browserstack/src/Sample/__init__.py", line 1, in <module>
from Appium import webdriver
ModuleNotFoundError: No module named 'Appium'
I have already set up Appium in my Eclipse IDE via Marketplace but still, the issue isn't resolved.
Upgrade to Python 3 and then install the Appium. I have faced the same issue and it get solved once updated to Python 3.
Are you sure you have appium installed? If no, install it via pip: pip install Appium-Python-Client
and then try to replace Appium
with appium
in your code. In my system, it worked
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With