Facing Exception error : selenium.common.exceptions.WebDriverException

I have added desired capability caps = { “platformName”: “ios”, “deviceName”: “iPhone 14”, “platformVersion”: “16”, “app”: “lt://APP1016045801683212035180225”, “build”: “Fierce”, “name”: “Login1”, “project”: “Fierceinhouse”, “deviceOrientation”: “portrait”, “isRealMobile”: True } driver = webdriver.Remote(" https://manesh.kadam:4PfGFzxs3nWXKFZGJmxsPXZWQFUPJvEayQg3Sz4zrIwuQEsH0s@mobile-hub.lambdatest.com/wd/hub", caps)

but getting an error:

alert_text = value[‘data’].get(‘text’) elif ‘alert’ in value: alert_text = value[‘alert’].get(‘text’) raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here

raise exception_class(message, screen, stacktrace) E selenium.common.exceptions.WebDriverException: Message: To use automation on desktop and virtual devices use http://hub.lambdatest.com/wd/hub

Hi Mark,

Upon checking the error, this refer to using to w3c protocol. To give a bit more context, for iOS 16 onwards, please send w3c-compliant capabilities only as Appium itself, is not supporting JSON wire capabilities now. Also, post-session creation also, all the commands should be in w3c compliant only.

from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
import time


desired_caps = {
    "platformName": "Android",
    "deviceName": "Samsung Galaxy S10",
    "isRealMobile": True,
    "platformVersion": "10",
    "app": "./Android_debug.apk",  # URL to your app on LambdaTest or some public URL
    "name": "Sample Mobile Test",  # Test name
    "build": "LambdaTest Appium Python Sample Build"  # Your build name
}
# Desired Capabilities
options = AppiumOptions().load_capabilities(desired_caps)
username = "*****"
access_key = "********"
# LambdaTest Hub URL
hub_url = f"https://{username}:{access_key}@mobile-hub.lambdatest.com/wd/hub"

# Initialize the remote WebDriver
driver = webdriver.Remote(
    command_executor=hub_url,
    options=options
)

I tried using app testing in lambda test using above code but getting error

selenium.common.exceptions.WebDriverException: Message: To use automation on desktop and virtual devices use http://hub.lambdatest.com/wd/hub

Name: Appium-Python-Client, Version: 4.2.0

Name: selenium, Version: 4.25.0

@LambdaTest Could you please help me here

Hi Varun,

You need to pass the capabilities as per W3C protocol as shown below :

desired_caps = { “lt:options”: { “w3c”: True, “platformName”: “android”, “deviceName”: “Pixel 3”, “platformVersion”: “9”, “isRealMobile”: True, “app”: “lt://APP1223234234234234234234” } }

Thanks!

thanks for replying. I tried your solution but now it gives me below error

An error occurred: Message: [INVALID_APP_ID] The app_id lt://APP10160501071730469274729643 specified in the ‘app’ params is invalid. Please specify a valid app_id that was returned in the response to upload app API request and try again.

I have taken this app id from lamba test after uploading an app

it got resolved. I no more see that error. Now i see an error related to my plan as my plan doesnt support app automation on real device. Thanks for helping out

1 Like

HI varun, An error occurred: Message: [INVALID_APP_ID] The app_id lt://APP10160501071730469274729643 specified in the ‘app’ params is invalid. Please specify a valid app_id that was returned in the response to upload app API request and try again.

This error may occur due to following reasons :

  1. Either you are using app id which is not available for your org.
  2. if you have passed app id incorrect.
  3. Either you are passing app id that has been expired. (Once you upload any application it stays in our database till 60 days. In this case you have to upload you application again)