React Native iOS apps, when tested in Appium UI Automation Inspector tool, unable to read Text values - react-native

React Native iOS apps, when tested in Appium UI Automation Inspector tool, unable to read static Text values.
Code:
<Text accessibilityLabel={'home_welcome_text'} testID={'home_welcome_text'}>Welcome Home
Issue:
In Appium Inspector, label field show 'home_welcome_text'. Which is not correct, it should give the text value 'Welcome Home' in the label field.
Note: This issue happens only in iOS builds. Android builds are working as expected.
Your help on this is much appreciated. Thank you.

Related

Recognizing element in an Hybrid App - Android

I am new to Android testing. I am currently trying to automate a scenario. I have attached the snapshot of the app screen:
Scenario:
I need to click on "Clock In".
A screen slides from the bottom as shown in the snapshot.
I need to select an item as shown by the arrow.
The developer is saying that it is a Hybrid app. A lot of confusion here for me as I am able to click on "Clock In", but I am not able to select "DL 380 Memory Upgrade".
Doubts:
How to find whether "DL 380 Memory Upgrade" is in Webview/Native?
If it is an element in the webview, how to locate it? I located "CLOCK IN" as below:
#AndroidFindBy(xpath = "//android.view.View[#resource-id='tab-t0-0']")
private AndroidElement clockInTabBtn;
If its an element in WebView, then its web and you won't find anything in web while searching by resource-id - its native attribute only.
I would recommend to use chrome dev tools for debugging hybrid application.
You can read official docs for setup.
Basically you need:
connect device
go to chrome://inspect/#devices in chrome browser
check phone & allow usb debugging if popup appears
check what webViews chrome spotted and click inspect for the one you need
And now you search for elements and their locators the same way you did in Selenum/Web automation
Don't forget to switch context to WebView in your appium test before you actually searching inside webView.
Good luck!
You can check available view using context and can switch to it using follows code:
Set<string> contextNames = driver.getContextHandles();
for (String contextName : contextNames)
{
System.out.println(contextNames);
//To swicth to webview
if (contextName.contains("WEBVIEW")){
driver.context(contextName);
}
}
Please refer this thread for similar issue: https://github.com/appium/appium/issues/7243

Automate a react native Android application using selenium

I'm trying to inspect element on react native app
but unfortunately I could not find any element on it, I have use ui automator viewer and appium inspector.
Can anyone help me please?
I have no problem to inspect react native application with appium desktop, you can check article on Sauce Labs blog with pretty good details and iOS RN app/python example.
It's a bit tricky to uniquely identify UI elements, but still possible with setting unique accessibilityLabel for the View on RN side and search for it with AccessibilityId locator strategy in Appium.
Provide more details in case you need additional help.
Unfortunately, without having accessibilityLabel in Views of RN app, you are limited to use xpath locator and search by element text, like "//android.widget.TextView[contains(text(), 'Skip')]".
Avoid using strict #text= as it might not work for every element ,e.g. if text split in 2 lines on some device.

React Native Appium picker

We have started developing an iOS/Android app using React Native. We have automated a lot of our functionality so far using Appium, but have run into a problem with being able to set or select values in a picker (date or choice picker).
I am trying to find if we need to try to fix Appium or look into providing a solution in React Native. I know native iOS/Android apps have solved this issue in the past couple of years, so hoping someone might have an idea on how to solve it for ReactNative.
An example of what we tried to do with Appium (based on what we did with our old iOS Application).
To pick "Colorado" from a picker, we would do the following:
driver.getElementById("IdOfElementOnPage").sendKeys("Colorado");
The problem is that this does not work. Even though it can find the field by id, it cannot select the value from the picker.
Here is a screenshot from Appium of the issue. See how the picker options are just one big blob of text?
enter image description here

How to automate native "Search" button in Appium Java

driver.findElementById("SearchField").sendKeys("bacon");
After sending keys the Native Keyboard opens automatically on IOS.
How can i automate Tap on native keyboard "Search"?
Appium + Java + Selenium + Eclipse
If you are using java-client 3.1.0, you can use this:
((AndroidDriver) driver).sendKeyEvent(AndroidKeyCode.ENTER);
Assuming you are automating a native mobile application. then you can easily click on the search button.
driver.findElement(By.Xpath("xpath of search icon")).click();
If you are automating web application then you need to change your context to native like below.
STEPS
Get the current context handles
Save the current context Context to Native
Change the Context to Native
Click on the search button
change the context to default
CODE
driver.getContextHandles();
String currentContext = driver.getContext();
driver.context("NATIVE_APP");
driver.findElement(By.Xpath("xpath of search icon")).click();
driver.context(currentContext);
Not sure if this would be helpful for you since it's been half a year but I did have a similar problem. If I was going to search with "Bruno Mars" in the search field, I would just have appium type in "Bruno Mars\n" and the newline would automatically trigger the search button. However, recently my devices weren't responding to the new line anymore. I winded up downgrading the google keyboard to 4.1.x and I was able to use new line method again. The problem was that the devices had auto updated to to version 5.x. So downgrading the keyboard solved the issue for me.

AIR Native Extension for accessing native UI controls on IOS

Does anyone have a clear idea about or a sample of air native extension that helps me use alert view of apple touch devices.
I tried a lot for the same but ended up getting no success.
Thanks in advance.
I am not tried this library anyhow please try with NativeAlert.
(OR)
This for alternative for access native UI.
You can try with ios-theme-for-flex-mobile-projects link.
This link shows like iOS Alert view.
Please find mobiletheme_ios_usage.fxp link you can download that project then workout.You can see iOS alert view(Not Native UI).