深度链接
根据URL和应用程序的包名(Android)或Bundle ID(iOS),在移动应用程序中打开深度链接URL。
用法
browser.deepLink(link, appIdentifier)
参数
名称 | 类型 | 详情 |
---|---|---|
link | string | 应该在移动应用程序中打开的深度链接URL。它应该是一个有效的深度链接URL(例如 myapp://path )。如果是可用于iOS的通用深度链接,请使用 browser.url("your-url") -方法。 |
appIdentifier | string | 应用程序的package (Android)或bundleId (iOS)的值,深度链接应该在该应用程序中打开。 |
示例
deeplink.js
it('should open a deep link for the WDIO native demo app', async () => {
// open the Drag tab with a deep link (this the bundleId for the iOS Demo App)
await browser.deepLink('wdio://drag', 'org.reactjs.native.example.wdiodemoapp');
// Or open the Drag tab with a deep link (this the package name for the Android Demo App)
await browser.deepLink('wdio://drag', 'com.wdiodemoapp');
// Or if you want to have it "cross-platform" you can use it like this
await browser.deepLink('wdio://drag', browser.isIOS ? 'org.reactjs.native.example.wdiodemoapp' : 'com.wdiodemoapp');
})