Appium-Create
2021/4/9 10:29:07
本文主要是介绍Appium-Create,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
目录
- Create New Session
- Example Usage
- Description
- Support
- Appium Server
- Appium Clients
- HTTP API Specifications
- Endpoint
- URL Parameters
- JSON Parameters
- Response
Create New Session
Create a new session
Example Usage
Java | DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.3" );desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator" );desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest" );desiredCapabilities.setCapability(MobileCapabilityType.APP, "/path/to/ios/app.zip" );URL url = new URL( "http://127.0.0.1:4723/wd/hub" );IOSDriver driver = new IOSDriver(url, desiredCapabilities); String sessionId = driver.getSessionId().toString(); |
Python | desired_caps = {'platformName' : 'Android' ,'platformVersion': '7.0' ,'deviceName' : 'Android Emulator' ,'automationName' :'UiAutomator2' ,'app' : PATH('/path/to/app' )self.driver=webdriver.Remote( 'http://127.0.0.1:4723/wd/hub' , desired_caps) |
Javascript | // webdriver.io example let options = { desiredCapabilities: { platformName: 'Android' ,platformVersion: '7.0' ,automationName: 'UiAutomator2' ,app: path.resolve( 'path' ,'to' , 'app.apk' )}};let client = driver.newSession(options); // wd example let driver = await wd.promiseChainRemote({ host: '127.0.0.1' ,port: 4723 }); let desiredCaps = { platformName: 'Android' ,platformVersion: '7.0' ,deviceName: 'Android Emulator' ,app: path.resolve( 'path' , 'to' ,'app.apk' )};await driver.init(desiredCaps); |
Ruby | # ruby_lib example APP_PATH = '../../path/to/app.app' desired_caps = { caps: { platformName: 'iOS' ,platformVersion: '10.2' ,deviceName: 'iPhone 6' ,app: APP_PATH, automationName: "XCUITest" } } Appium::Driver.new(desired_caps).start_driver # ruby_lib_core example ::Appium::Core.for(desired_caps).start_driver |
C# | AppiumOptions capabilities = new AppiumOptions(); appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android" );appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "7.1.1" );appiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Android Device" );appiumOptions.AddAdditionalCapability( "appPackage", "com.instagram.android" );appiumOptions.AddAdditionalCapability( "appActivity","com.instagram.android.activity.MainTabActivity" );AndroidDriver driver = new AndroidDriver(new Uri( "http://127.0.0.1:4723/wd/hub" ), appiumOptions); |
PHP |
Description
服务器应尝试创建与所需功能最匹配的会话。
- JSONWP Spec所需的功能具有比所需功能更高的优先级,必须为要创建的会话进行设置
- W3C Spec能力.alwaysMatch必须为要创建的会话设置;功能.firstMatch必须至少匹配一个(将使用第一个匹配的)
Support
Appium Server
与上篇一致
Appium Clients
与上篇一致
HTTP API Specifications
Endpoint
POST /session
URL Parameters
None
JSON Parameters
name | type | description |
---|---|---|
desiredCapabilities | object | (JSONWP specification) Object describing session’s desired capabilities |
requiredCapabilities | object | (JSONWP specification) Object describing session’s required capabilities that must be applied by remote end |
capabilities | object | (W3C specification) object containing ‘alwaysMatch’ and ‘firstMatch’ properties |
capabilities.alwaysMatch | object | The desired capabilities that the remote end must match |
capabilities.firstMatch | array<object> | List of capabilities that the remote end tries to match. Matches the first in the list |
Response
An object describing the session's capabilities (object) //描述会话功能的对象(object)
这篇关于Appium-Create的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-25【机器学习(二)】分类和回归任务-决策树(Decision Tree,DT)算法-Sentosa_DSML社区版
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享