我可以使用 safari 移动用户代理自动化苹果支付吗
Can I automate apple pay using the safari mobile user agent
我有一个使用 google play 和 apple pay 进行支付的电子商务应用程序。我使用 Puppeteer 开发自动化套件。
使用 google 播放,我没有遇到任何问题,但对于 apple pay,您需要使用 Safari。
我使用用户代理来表示用户来自 iOS safari 的应用程序:
await page.setUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/83.0.4103.88 Mobile/15E148 Safari/604.1");
但这于事无补。我没有看到 apple pay 按钮。
真的可以用Puppeteer 做Apple Pay 支付吗?因为我找不到任何关于它的问题。
我认为目前不可能。最接近模拟真实 iOS 设备的不是 puppeteer,而是 microsoft/playwright,它是 puppeteer 的继任者(当时与 puppeteer 由同一个团队在 Google 制作)并且支持WebKit浏览器引擎。
如果我使用模拟的 iPhone 11 设备访问 https://applepaydemo.apple.com/,它给出:
Your browser or device does not support Apple Pay on the web.
To try out this demo, open this page in Safari on a compatible device.
你可以在没有本地 npm 安装的情况下在这里测试它:https://try.playwright.tech/
const playwright = require('playwright')
async function fn() {
const { webkit, devices } = playwright
const iPhone11 = devices['iPhone 11 Pro']
const browser = await webkit.launch()
const context = await browser.newContext({
viewport: iPhone11.viewport,
userAgent: iPhone11.userAgent,
ignoreHTTPSErrors: true
})
const page = await context.newPage()
await page.goto('https://applepaydemo.apple.com/')
await page.screenshot({ path: 'example-iphone.png' })
await browser.close()
}
fn()
目前我不知道有任何解决方法可以让 Apple Pay 在非iOS 设备上工作。
我有一个使用 google play 和 apple pay 进行支付的电子商务应用程序。我使用 Puppeteer 开发自动化套件。
使用 google 播放,我没有遇到任何问题,但对于 apple pay,您需要使用 Safari。
我使用用户代理来表示用户来自 iOS safari 的应用程序:
await page.setUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/83.0.4103.88 Mobile/15E148 Safari/604.1");
但这于事无补。我没有看到 apple pay 按钮。
真的可以用Puppeteer 做Apple Pay 支付吗?因为我找不到任何关于它的问题。
我认为目前不可能。最接近模拟真实 iOS 设备的不是 puppeteer,而是 microsoft/playwright,它是 puppeteer 的继任者(当时与 puppeteer 由同一个团队在 Google 制作)并且支持WebKit浏览器引擎。
如果我使用模拟的 iPhone 11 设备访问 https://applepaydemo.apple.com/,它给出:
Your browser or device does not support Apple Pay on the web. To try out this demo, open this page in Safari on a compatible device.
你可以在没有本地 npm 安装的情况下在这里测试它:https://try.playwright.tech/
const playwright = require('playwright')
async function fn() {
const { webkit, devices } = playwright
const iPhone11 = devices['iPhone 11 Pro']
const browser = await webkit.launch()
const context = await browser.newContext({
viewport: iPhone11.viewport,
userAgent: iPhone11.userAgent,
ignoreHTTPSErrors: true
})
const page = await context.newPage()
await page.goto('https://applepaydemo.apple.com/')
await page.screenshot({ path: 'example-iphone.png' })
await browser.close()
}
fn()
目前我不知道有任何解决方法可以让 Apple Pay 在非iOS 设备上工作。