Not able to select option from dropdown box in an android mobile application

1.1k views Asked by At

I have to automate payment gateway process for my native android application for which i have to select option from dropdowon box. After selecting an option "continue" button will be enabled. On clicking continue button it takes me to new screen where payment details will be entered.

I'm facing following issues:

1) Not able to select drop down menu option after scrolling in the drop drown.

2) Able to select the option from first 5 options which are visible when dropdwon opens without any scrolling.after the option selection continue button has to be enabled by defalut.i am able to see that option got selected but not able to click on continue button.Script is not returning any error but i am sure it is not clicking on continue button.

Before clicking on dropdown id and class of dropdown are packagename;id/statechooser and android.widget.spinner respectively.

After click on dropdown id and class are android:id/text1 and android.widget.Textview.

Below is my code.

#entering Name
self.driver.find_element_by_id('packagename:id/name').send_keys('App Test');
self.driver.keyevent(66)
#entering address line 1
self.driver.find_element_by_id('packagename:id/address_line_1').send_keys('Madison Boulevard')
self.driver.keyevent(66)
self.driver.find_element_by_id('packagename;id/city').send_keys('Madison');
self.driver.find_element_by_id('packagename;id/zip').send_keys('25758');
self.driver.keyevent(66)(#this event for moving to dropdown)
self.driver.keyevent(66)(#this event for opening dropdown)
self.driver.find_element_by_xpath("//android.widget.TextView[@text='Alabama']").click()
self.driver.find_element_by_id('packagename:id/continue_button').click();
1

There are 1 answers

0
Suneetha Thentu On BEST ANSWER

Finally I got solution for this. By using python wrapper for UIAUTOMATOR I am able to proceed to next page.I am using down method until the option is visible and then pressing enter to accept it instead of click method. Below is the code.

while(self.d(resourceId="android:id/text1").text!='Hawaii'):
        self.d.press('down');
self.d.press('enter')