Appium 1.5.0
Xcode 7.3
IOS 10.11.4 OSX EI Capitan
Using on:Simulator iOS 8.1
Run Code Online (Sandbox Code Playgroud)
我的XML
<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
<UIAApplication value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="0" width="375" height="667">
<UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0" x="0" y="0" width="375" height="667">
</UIAWindow>
<UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1" x="0" y="0.6875" width="375" height="665.625">
<UIAImage name="icon-menu-logo.png" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1/0" x="11.71875" y="33.5" width="46.875" height="46.875">
</UIAImage>
<UIAStaticText dom="" enabled="true" valid="true" visible="false" hint="" …Run Code Online (Sandbox Code Playgroud)错误:
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) 有没有人知道如何通过appium python客户端缩放android中的元素?
我目前正在使用
self.driver.zoom(self.element, percent) 但这会给出错误
self.driver.zoom(self.element, percent)
File "/usr/local/lib/python2.7/site-packages/appium/webdriver/webdriver.py", line 308, in zoom
self.execute_script('mobile: pinchOpen', opts)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 461, in execute_script
{'script': script, 'args':converted_args})['value']
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 233, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
WebDriverException: Message: Method has not yet been implemented
Run Code Online (Sandbox Code Playgroud)
我也试过了MultiAction.
loc = self.element.location
print loc
xx, yy = loc["x"], loc["y"]
xx=700
action1 = TouchAction(self.driver)
action1.long_press(x=xx, y=yy).move_to(x=0, y=1000).release()
action2 = TouchAction(self.driver)
action2.long_press(x=xx, y=yy).move_to(x=0, y=-1000).release()
m_action = MultiAction(self.driver)
m_action.add(action1, action2) …Run Code Online (Sandbox Code Playgroud) 我需要更新 .mp4 文件的创建时间,以便它出现在按创建日期排序的媒体文件列表的顶部。我可以使用 os.utime 轻松更新文件的访问日期和修改日期,但尚未找到将文件的创建日期更改为“现在”的好方法。
我的最终目标是使用 appium 将媒体文件种子到 iOS 模拟器,并在该脚本中访问这些媒体文件。问题是视频文件不会显示在应用程序的“最近添加”部分,因为它已经有几天了。
这是检查录制是否正常的python代码:
def setUp(self):"Setup for the test"
desired_caps = {}
desired_caps['browserName']=''
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = 'd65d04425101de'
# Returns abs path relative to this file and not cwd
desired_caps['app'] = '/home/karthik/appiumworkspace/tests/app-debug (2).apk'
desired_caps['appPackage'] = 'com.prueba.maverick'
desired_caps['app-activity'] = '.SplashActivity'
desired_caps['app-wait-activity'] = '.MainActivity'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
def tearDown(self):
"Tear down the test"
self.driver.quit()
def test_whether_app_is_installed(self):
"Test if the app has been installed correctly"
self.driver.is_app_installed('com.prueba.maverick')
print('APP HAS BEEN INSTALLED')
def test_record_the_audio(self):
"Test it clicks on Record button correctly"
element = …Run Code Online (Sandbox Code Playgroud) 直到今天,我的 appium GUI 都运行良好。当我尝试启动 appium 时,出现此错误。我不知道如何绕过它。因此,高度赞赏任何建议/解决方案。
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' appium/build/lib/main.js --pre-launch --debug-log-spacing --automation-name "Appium" --platform-name "Android" --platform-version "6.0" --app "/Users/iamtheuser/fitbit/automation/artifacts/myapp.apk" --language "en" --locale "US"
Error: Cannot find module 'appium-base-driver'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (lib/main.js:7:58)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
at node.js:404:3
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 appium 来测试一个真实手机上的应用程序。启动将花费 25 秒。如何加快速度?
appium桌面版本:1.5
Android操作系统:7.1
from appium import webdriver
class AppTester(object):
"""docstring for AppTester"""
def __init__(self, command_executor, desired_capabilities):
super(AppTester, self).__init__()
self.driver = webdriver.Remote(command_executor, desired_capabilities)
def click_ui_element(self, ui_selector):
self.driver.find_element_by_android_uiautomator(ui_selector).click()
import time
from app_tester.tester import *
app_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'platformVersion': '7.1',
'appPackage': 'com.freescale.kinetisbletoolbox',
'appActivity': 'com.freescale.bletoolbox.activity.CheckActivity',
'autoGrantPermissions': True,
# 'locationServicesAuthorized': True,
'autoAcceptAlerts': True,
# 'gpsEnabled': True,
'noReset': True,
'fullReset': False,
}
app_url = 'http://localhost:4723/wd/hub'
secs = time.time()
app = AppTester(app_url, app_caps)
print 'start …Run Code Online (Sandbox Code Playgroud) 我正在测试一个使用蓝牙的应用程序,我有一个 python 函数将它连接到服务器并显示一些字符串。我想将该字符串存储在变量中并将其与其他字符串进行比较。
我已将结果存储在结果变量中,但可以使用它比较字符串
*** Settings ***
Library AppiumLibrary run_on_failure=Capture Page Screenshot
Library String
Library bt.py
*** Variable ***
${appium_1}= http://0.0.0.0:4723/wd/hub
${platform_name}= android
${platformVersion}= 9
${deviceName}= b6722e70
${app}= /home/user/Downloads/pre-prod.apk
${result}
*** Test Cases ***
App_Test_1
[Documentation] Test Case to Login
Open Application ${appium_1}
platformName=${platform_name} deviceName=${deviceName}
app=${app}
Capture Page Screenshot
Click Element id=com.vendekin:id/intro_btn_skip
Sleep 4
Wait Until Element Is Visible id=com.vendekin:id/phone
input text id=com.vendekin:id/phone
Click Element id=com.vendekin:id/login
Sleep 5
Wait Until Element Is Visible id=com.vendekin:id/otp
Click Element id=com.vendekin:id/otp
sleep 15
Wait …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 appium 实现“By”和“Keys”,就像我在 selenium 上实现的那样。
在硒上我可以这样做:
定位器
from selenium.webdriver.common.by import By
class LoginPageLocators(object):
HEADING = (By.CSS_SELECTOR, 'h3[class="panel-title"]')
USERNAME = (By.NAME, 'username')
PASSWORD = (By.NAME, 'password')
LOGIN_BTN = (By.CSS_SELECTOR, 'input[value="Login"]')
Run Code Online (Sandbox Code Playgroud)
功能
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from base import Page
from locators.locators import *
class LoginPage(Page):
def __init__(self, context):
Page.__init__(
self,
context)
def goto_login_page(self, url):
self.open(url)
def enter_username(self, username):
uname = self.find_element(*LoginPageLocators.USERNAME)
uname.send_keys(username)
def enter_password(self, password):
pword = self.find_element(*LoginPageLocators.PASSWORD)
pword.send_keys(password)
def click_login(self):
login = self.find_element(*LoginPageLocators.LOGIN_BTN)
login.click()
def verify_dashboard_page(self, …Run Code Online (Sandbox Code Playgroud) 我最近接手了一个使用Appium进行自动移动测试的项目。我有一些应该与Appium一起运行的python脚本,但是当尝试运行它们时,我遇到了“ [INSTALL_FAILED_VERSION_DOWNGRADE]”。经过对此事的大量研究,我认为这是与Android相关的问题,它是APK版本。但是,我是Android的新手,因此要完全了解Appium和Android所做的工作就很困难。在尝试将应用程序安装到设备上时,我更倾向于解决问题,但是我觉得我已经解决了排除故障的步骤。一些示例可确保我拥有该应用程序的最新版本,卸载该应用程序,重新安装该应用程序的较旧版本并最终检查更新。
Python脚本回溯:
Traceback (most recent call last):
File "main.py", line 310, in <module>
launch()
File "main.py", line 26, in launch
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "C:\Python\lib\site-packages\appium\webdriver\webdriver.py", line 36, in __init__
super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: A new session could …Run Code Online (Sandbox Code Playgroud) 在 Appium文档中,它说我必须传入 x 和 y 值。我如何知道我想要向左或向右滑动的部分的 x 和 y 值。我正在使用 uiautomationviewer (Android),我需要任何工具吗?
driver.swipe(start_x=75, start_y=500, end_x=75, end_y=0, duration=800)
Run Code Online (Sandbox Code Playgroud) python-appium ×11
appium ×10
python ×8
android ×6
appium-ios ×2
apk ×1
automation ×1
ios ×1
npm-install ×1
python-2.7 ×1
selenium ×1
zoom ×1