使用 python 和 appium 测试移动浏览器自动化时需要 URI 和包参数

问题描述 投票:0回答:1

我正在尝试使用 python 和 appium 运行移动浏览器自动化。我正在提供所需的所需功能。但运行脚本后,它返回以下错误

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: URI and package arguments are required Stacktrace:UnknownError: An unknown server-side error occurred while processing the command. Original error: URI and package arguments are required
at getResponseForW3CError (C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
at asyncHandler (C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)

下面提供了我的源代码

from appium import webdriver
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait



desired_caps = {
'platformName': 'Android',
'deviceName': 'AQE6MVWWAEVOZLTO-r1HMVZ',
'udid': '22e051b70d1783d3',
'appPackage': 'com.android.chrome',
'appActivity': 'com.google.android.apps.chrome.Main',
'showChromedriverLog': True,
 'automationName': 'UiAutomator2',
'noReset': False
}
web_driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
# Open a website
web_driver.get('https://www.google.com')

web_driver.find_element(By.XPATH, '//*[@id="js-search-autocomplete"]').send_keys("USA")
wait = WebDriverWait(web_driver, 10)
date = wait.until(ec.element_to_be_clickable((By.XPATH, '//*[@id="js-date-range-display"]')))
date.click()
time.sleep(125)
web_driver.execute_script('mobile: shell', {'command': 'pm', 'args': ['clear', 'https://www.rentbyowner.com']})
# Close the browser
web_driver.quit()

请帮助我。我所期望的能力是否缺少任何东西? 预先感谢

python android selenium-webdriver appium
1个回答
0
投票

尝试将

browserName='Chrome',
功能添加到您的
desired_caps
字典中,看看它是否有效。

© www.soinside.com 2019 - 2024. All rights reserved.