Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jaimin180296/aaa40d0fe81bdd11475707d1e91442fe to your computer and use it in GitHub Desktop.
Save Jaimin180296/aaa40d0fe81bdd11475707d1e91442fe to your computer and use it in GitHub Desktop.
Apple pay
require 'rubygems'
require 'appium_lib'
require 'selenium-webdriver'
caps = {
"platformName" => "ios",
"platformVersion" => "14.0",
"deviceName" => "iPhone 11",
#"app" => "bs://db06185390824f25c0f7cea51b3379a4e62fd0da",
"automationName"=> "flutter",
"app" => "bs://58b11616da47af3d02a88ac3cd945c3f6bc95913",
'bstack:options' => {
"enableBiometric" => true
},
}
# devdf
#caps['browserstack.user'] = ''
#caps['browserstack.key'] = ''
##caps['browserstack.enableApplePay'] = "true"
#caps['browserstack.resignApp'] = "false"
# caps['app'] = "bs://" # Sample app in devdf, enterprise
# Specify device and os_version for testing
#caps['device'] = "Xiaomi Redmi Note 11"
#caps['os_version'] = "11.0"
# Set other BrowserStack capabilities
#caps['project'] = 'My Test'
#caps['build'] = 'browserstack-build-3'
#caps['name'] = 'my test'
#Set the platform name
#caps['platformName'] = 'android'
appium_driver = Appium::Driver.new({
'caps' => caps,
'appium_lib' => {
# :server_url => "http://hub-cloud.browserstack.com/wd/hub"
}}, true)
driver = appium_driver.start_driver
puts driver.device_time
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
driver.activate_app("com.apple.mobilesafari");
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
el2 = driver.find_element :accessibility_id, "TabBarItemTitle"
el2.click
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
driver.send_keys "https://applepaydemo.apple.com"
wait = Selenium::WebDriver::Wait.new(:timeout => 2)
el4 = driver.find_element :accessibility_id, "Go"
el4.click
wait = Selenium::WebDriver::Wait.new(:timeout => 15)
sleep(10)
el9 = driver.find_element :name, "Apple Pay"
el9.click #svg-logo
#response = driver.execute_script("browserstack_executor: {\"action\":\"applePay\", \"arguments\": { \"confirm\" : \"true\" }}");
response = driver.execute_script("browserstack_executor: {\"action\":\"applePay\", \"arguments\": { \"confirm\" : \"true\" }}");
driver.send_keys('123456')
sleep(20)
driver.quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment