Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve 'No module named Appium' error

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.

like image 558
Catherine Pequiño Avatar asked Oct 19 '25 16:10

Catherine Pequiño


2 Answers

Upgrade to Python 3 and then install the Appium. I have faced the same issue and it get solved once updated to Python 3.

  1. Uninstall Python 2.7
  2. Install Python 3 & above (latest: Python 3.7.4 )
  3. upgrade the pip
  4. Install Appium client (> pip install appium-python-client)
  5. Then run the script
like image 121
M.J Avatar answered Oct 22 '25 04:10

M.J


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

like image 28
Kolay.Ne Avatar answered Oct 22 '25 04:10

Kolay.Ne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!