I'm trying to set a date on a native android application using with Ruby + Appium + UIAutomator2.
First, Appium desktop doesn't show native datepicker on the inspection field. So, I couldn't try to swipe for the datepicker wheels.
After that I tried
send_keys()
but not a chance.
Finally, I tried the command below with "appium --relaxed-security":
driver.execute_script('mobile: shell', {'command': 'input text', 'args': '04 / 05 / 1990'})
but it didn't work neiether.
How to solve the issue? Thanks
Have you tried using UI Automator Viewer (which is part of Android SDK)?
You can connect a real device or use emulator, start the app, start UI Automator Viewer and grab a screenshot with it. You will be able to see entire screen and inspect it. This will help with creating the selectors for those nasty native elements.
Video tutorial here.
Related
Device: Android
App: react native hybrid app
Appium/Appium Inspector version: Version 1.15.1 (1.15.1.20191013.2)
Issue:
I am unable to inspect a picker/dropdown. It doesn't appear in the app source at all. Hence unable to find any locators to do further automation.
Description:
I open the android app on the mobile and navigate to a form where
certain details need to be filled.One of the things to be filled is
a dropdown.
I click on the arrow on the dropdown field
A NEW window/popup appears on top of the ORIGINAL form for the
picker values to be displayed, which can be scrolled to see various
values.
This new picker value window/pop up doesnt not come in the app
source in the appium inspector at all
Can you please tell me a workaround to automate this scenario to select values in the dropdown.I am using Java + Selenium + Appium for the automation framework .
Thank you!
I hope you have used uiautomatorviewer to inspect the element on Android App. Can you please check on uiautomatorviewer if not done already.
Certain pages in our android native app are not inspectable with Appium Desktop and Appium Studio. However with uiAutomatorViewer, I can inspect those screens and take resource-ids. But Appium is unable to locate element with these Ids/xpaths. Did check with dev team but they are not sure about what is going on. Does anyone had similar issues?
Any help or suggestions would appreciated much!!
Before finding element may be you can try getDriver().getPageSource() and by using this it will get the focus of the driver and then try finding elements. If this doesnt help try printing getdriver().getpagesource() in console and try to look whether the element is present in the pagesource or not. if it is there then you can use document builder and parse the pagesource text and get xpath element out of it and once you get the element (this will be generic XML element) get attributes like location and using that tap at that coordinates and this will defenitely work
I had the same problem just when dialogs where shown, To have it working I send the app to background for 0 secs, after a dialog was dismissed, and I was able to resume my tests
Python code
driver.background_app(secs) #you can specify 0 secs
Java code
driver.runAppInBackground(secs) //you can specify 0 secs
Let me know if it worked
I'm using WebDriver.io to create tests.
In the Docs getSource doesn't support native apps.
Get source code of the page. This command won’t work in mobile
environments for native apps. If you are running hybrid tests make
sure that you are in the webview before calling this command.
For now, I use "client.source()" link which return the XML but can take up to 20 sec.
How can I get the layout XML from webDriver.io?
You are doing it the right way. Alternatively you can try the WD.js client and check if performance will be better with than the other one, or simply open an issue report on the WebdriverIO Github page.
The reason of why it may take so long:
UI of the app is constantly updating => Appium is hanging for a bit to retrieve it;
Lots of elements on your app page => leads to a big .xml file.
I am looking for a way to inspect an running Android application layout (preferably, by dp/sp), like something as you can see in those Google Chrome/Firefox/Safari live HTML inspector feature.
I have an Android app which needs to follow a strict design guideline and comparing between the guideline and the application itself is quite cumbersome and taking a lot of time to jump around multiple source codes and layout .xml(s) to check a design conformity, so it'd be very efficient to have such debugger.
I should also mention that the app needs specific Android devices to run (unable to run on an simulator or unapproved devices).
Your ideas would be greatly appreciated.
Thank you.
You can test this built-in feature in android studio run the app and after click on the layout inspector "
I'm working on an application for Android using phonegap
I have the input with type "date" which open android date picker.
But when I am trying to click set the selected date, the app crashes.
Any ideas?
Hi Guys I figured out and fixed the issue. This is the cause of the problem which is mentioned here Invoke native date picker from web-app on iOS/Android
Apparently I had to pick a JS datepicker which looks like the native one to fix the issue. and of course the needed to be changed to "text"
I used mobipick http://mobipick.sustainablepace.net/ - it worked just great!!!
This is not fixed.
FYI this happens with the native datepicker (NO Plugin used). in my case I have 2
if I pick any date for 1 the other doesnt work. it pops up the native datepicker but then if I press set it does nothing and after a while get frozen (static and I can't do anything & have to kill the app)
FYI - the web view (if I browse it from the browser) it works fine but not in the app. I used build.phonegap to build the app