0

I want to click on element shown in picture (purple circle with M letter in center of it) using selenium webdriver.

Element is located on navigation bar. I tried to find element using Appium Desktop, but unsuccessfully. Android screenshot how far I get

My code executes everything until navigation bar is opened.

# Android environment
import unittest
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
from appium.webdriver.common.touch_action import TouchAction
from time import sleep

class TESTZERO(unittest.TestCase):

    def setUp(self):
        desired_caps = {}
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '5.0'
        desired_caps['deviceName'] = 'JUST5 Blaster'
        desired_caps['appPackage'] = 'com.android.vending'
        desired_caps['appActivity'] = 'com.google.android.finsky.activities.MainActivity'
        self.driver = webdriver.Remote('http://localhost:5000/wd/hub', desired_caps)

    def test_accept(self):
        "Test Accept button"
        self.driver.implicitly_wait(20)
        element = self.driver.find_element_by_id('com.android.vending:id/positive_button')
        element.click()

        element = self.driver.find_element_by_id('com.android.vending:id/navigation_button')
        element.click()


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TESTZERO)
    unittest.TextTestRunner(verbosity=2).run(suite)

Any ideas how to find and click or tap this element?

1 Answers1

2

Add desired_caps['automationName'] = 'UiAutomator2' and try to find element with:

self.driver.find_element_by_id('com.android.vending:id/secondary_avatar_frame_right')

I strongly suggest to use appium-desktop for inspecting elements:

enter image description here

dmle
  • 3,498
  • 1
  • 14
  • 22
  • I was using Appium Desktop before and after taping navigation bar i could not click elements on navigation bar but only those in background! – Mārcis Liepiņš Nov 23 '17 at 09:33
  • Just launched Appium Desktop again and find out that i can not click navigation bar items in screenshot part of the Appium Desktop interface, but can find them through App source code! – Mārcis Liepiņš Nov 23 '17 at 09:35