目录
问题1:Mac和iOS通信 进行自动化测试参考Desired Capabilities官方说明文档
问题2:driver = webdriver.Remote(“http://localhost:4723/wd/hub“, caps)
问题10:Mac和iOS通信 进行自动化测试参考Desired Capabilities官方说明文档
问题11:SessionNotCreatedException
问题12:AttributeError: 'XXX' object has no attribute 'endswith'
问题13:appium 中inspect (如何切换定位H5 原生APP 混合型APP) 定位
appium 库一定要装
问题1:Mac和iOS通信 进行自动化测试参考Desired Capabilities官方说明文档
参考如下进行配置:
Desired Capabilities官方说明文档:Desired Capabilities in Selenium Testing With Examples
问题2:driver = webdriver.Remote(“http://localhost:4723/wd/hub“, caps)
An unknown server-side error occurred while processing the command
处理命令时发生未知的服务器端错误
An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.tencent.mobileqq' application
问题出现 appium server ,修改appium服务器
localhost:4723 改为127.0.0.1:4723
问题3:Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
问题4:An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output
An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output
处理命令时发生了一个未知的服务器端错误.原始错误:无法初始化检测过程。制作确保测试中的应用程序不会崩溃,并调查logcat输出。
第一步检查手机设备是否正常
adb devives
第二步检查手机上启动脚本时注意手机提示安装appium setting否者连接。调试脚本时需要注意手机动态
第三步检查appium上日志输出
第四步检查app日志输出,命令如下:
adb shell logcat
问题5:The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
找不到请求的资源,或者使用映射资源不支持的 HTTP 方法接收到请求
问题6:Encountered internal error running command: Error: Device 127.0.0.1:4723 was not in the list of connected device
设备断开了,连接配置信息错误,如udid(adb devices获取)
检查是否连接,时时注意手机动态
问题7:Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
运行如下两句
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
问题8:Encountered internal error running command: Error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output
Encountered internal error running command: Error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output
遇到内部错误运行命令:错误:无法初始化检测进程。 确保被测应用程序没有崩溃并调查 logcat 输出
确保如上三个全部安装
package:io.appium.settings
package:io.appium.uiautomator2.server
package:io.appium.uiautomator2.server.test
确保如上三个全部安装
问题9:scrcpy 无线投屏 无法连接
首先使用USB 数据连接手机和电脑,手机打开开发者模式
使用adb devices 发现如下则没有连接上,请检查 开发者调式功能是否打开
打开开发调式即可再次输入adb devices
然后在scrcpy 进行无线投屏 连接操作步骤如下:GitHub - Genymobile/scrcpy
adb devices
确定是否连接
adb tcpip 5555
后面的5555为端口,可以指定其他的端口,前提是端口未被调用
adb connect 192.168.xxxx.xxxx:5555
192.168.xxxx.xxxx为你手机的ip地址,5555为了设置·的端口号
adb devices
检查是否刚才输入192.168.xxxx.xxxx:5555
scrcpy
输入scrcpy即可投屏
问题10:Mac和iOS通信 进行自动化测试参考Desired Capabilities官方说明文档
参考如下进行配置:
Desired Capabilities官方说明文档:Desired Capabilities in Selenium Testing With Examples
问题11:SessionNotCreatedException
java报错:SessionNotCreatedException: Could not start a new session. Response code 500
System.setProperty("webdriver.chrome.driver",
"D:\\script\\java\\StudentAutoExcel\\DriverExe)
系统环境变量设置了版本对应还是设置脚本设置启动webdriver
需要设置System.setProperty() 路径带上exe 设置 webdriver驱动的路径
python报错:exceptions.SessionNotCreatedException: Message: session not created: This version of xxxdriver
问题12:AttributeError: 'XXX' object has no attribute 'endswith'
如下几种报错
AttributeError: 'int' object has no attribute 'endswith'
AttributeError: 'float' object has no attribute 'endswith'
AttributeError: 'bool' object has no attribute 'endswith'
了解endswith使用方法:startswith() 和 endswith() 都对字符处理
解决办法:①检查本身代码脚本是否为 str 字符串
②如调用外部文件如execl,yml,yaml 在代码进行强转操作为 str 字符串
问题13:appium 中inspect (如何切换定位H5 原生APP 混合型APP) 定位
问题14:自动下载更新浏览器驱动可能会遇到问题?
public WebDriver createChromeAndroidDriver(String browserVersion,String deviceName, URL appiumServerUrl) {
// Resolve driver and get its path(解析驱动程序并获取其路径)
WebDriverManager wdm = WebDriverManager.chromedriver().browserVersion(browserVersion);
wdm.setup();
String chromedriverPath = wdm.getDownloadedDriverPath();
// Create WebDriver instance using the driver path
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("version", browserVersion);
capabilities.setCapability("deviceName", deviceName);
capabilities.setCapability("platformName", "android");
capabilities.setCapability("chromedriverExecutable", chromedriverPath);
return new AndroidDriver<WebElement>(appiumServerUrl, capabilities);
}