Video play/pause buttons not found

Hi,

I’m trying to automate a video player test in an Android app. My scenario is after video is starting to play, I click on the video thumbnail again and playPause button and Next button is seen for few seconds on the screen. I want to click or tap on them, but getting throws NoSuchElementFound exception. However, when I look at the page source, I see the elements I want to test in source page. Any idea how to test those buttons and why those elements not found while testing?

Thanks for help.

Often when Appium cannot find an element, but you later see them in the page source, the problem is that Appium moves too fast and the page is not rendered yet. You don’t really give enough information for a definite conclusion, but I encourage you to look into implicit waits:

http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Hey thanks for your answer. I’ve tried implicit wait then Appium found the element. However, my problem is now, after finding element, I tapped again somewhere to display buttons and then I want to tap on it to turn pause button to play, but when I give tap action, Appium again returns NoSuchElementException. Briefly, Playpause button is seen for few seconds. What I want , throughout these buttons are visible, I want to take some actions on them.

Thanks for help.

My guess is that Appium is not able to find the video playback controls in the amount of time they are visible given the existing locators.

You might have to resort to tapping or pressing on specific coordinates where you expect the button to appear.

Thanks for reply. I’ll try this.

This might useful for someone.