错误:
HOOK-ERROR in before_scenario: TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'
您好,我们目前无法与最新的 Selenium 4.10 一起运行我们的脚本。这是 Appium 错误还是 Python 错误?
这是我们使用的功能。我们当前正在尝试获取 platformName 的功能,targetOS = self.driver.capabilities['platformName']但遇到了此错误
capabilities = {
"platformName": "Android",
"appium:platformVersion": "11.0",
"appium:deviceName": "emulator-5554",
"appium:app": "/Users/faithberroya/Downloads/test.apk",
"appium:automationName": "UiAutomator2",
"appium:appPackage": "com.test.school.assignment.rc",
"appium:appActivity": "com.test.school.assignment.ui.SplashActivity"
}
# launch app
context.driver = webdriver.Remote("http://0.0.0.0:4723/wd/hub", capabilities)
# add wait time
context.driver.implicitly_wait(20)
# app
context.app = Application(context.driver)
Run Code Online (Sandbox Code Playgroud)
当前点列表
Appium-Python-Client 2.10.1
behave 1.2.6
certifi 2023.5.7
pip 23.1.1
requests 2.31.0
selenium 4.9.0
Run Code Online (Sandbox Code Playgroud) 您好:/我目前在项目中设置下载文件夹时遇到问题。
我正在使用 Mac、Pycharm CE、Selenium、Python、Behave 和 Firefox(项目要求)。
我尝试了此配置Python Selenium Firefox 下载目录出现问题,但我不确定我做错了哪一部分。:/ 下载的文件仍位于默认的下载文件夹中。
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
@given("First step")
def step_impl(context):
download_path = "/Users/this/is/the/absolute/path/downloads"
options = Options()
options.set_preference("browser.download.folderList", '2')
options.set_preference("browser.download.manager.showWhenStarting", False)
options.set_preference("browser.download.dir", download_path)
options.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv")
context.driver = webdriver.Firefox(options=options)
Run Code Online (Sandbox Code Playgroud)