In my ruby script pasted below, after the first alert__accept, the Android dialogue box appears to go away, but I get the error “An element could not be located” on find__element(:id, ‘com.myapp.app:id/grant__microphone__permission__button’).click
If I paste this and run it in ARC, I have no issue. I’ve tried adding page right after the first alert__accept, but when I run the ruby script, I get no output. It’s as if Appium has ‘lost’ my app, even though it is appearing on the screen.
Details: Using Appium 1.6, physical Android Nexus 6P with latest OS
require 'rubygems'
require 'appium_lib'
APP_PATH = './app-debug.apk'
DEVICE_NAME = 'fakedevice' #adb devices
#define capabilities
desired_caps = {
caps: {
platformName: "android",
deviceName: DEVICE_NAME,
app: APP_PATH
}
}
# start driver
@driver = Appium::Driver.new(desired_caps)
@driver.start_driver
module SignInTest
module MainPage
#makes finde_element accessible
Appium.promote_appium_methods Object
#assign buttons
find_element(:id, 'android:id/content').click
find_element(:id, 'com.myapp.app:id/log_in_button').click
find_element(:id, 'android:id/content').click
@email = '[email protected]'
@password = 'fakepassword'
find_element(:id, 'com.myapp.app:id/change_email_dialog_fragment_email_edit_text').type(@email)
find_element(:id, 'com.myapp.app:id/password_edit_text').type(@password)
find_element(:id, 'com.myapp.app:id/log_in_button').click
# Accept Location permissions
# Screen presents permissions dialog
find_element(:id, 'com.myapp.app:id/grant_location_permission_button').click
# Android alert is shown
alert_accept
#Accept Microphone permissions
# Screen presents permissions dialog
find_element(:id, 'com.myapp.app:id/grant_microphone_permission_button').click
# Android alert is shown
alert_accept
# teardown
@driver.driver_quit
end
end