Android Unable to identify elements in Appium inspector instead of one element whole panel type of area is selecting - appium

This is image of android inspectorUnable to identify elements in Appium inspector instead of one element whole panel type of area is selecting when I click on menu I want to select on element from that menu which comes from left to right.
Please help me so that I can find a single element's xpath right now whole panel is getting selected in appium inspector. enter image description here this is on android.

Unfortunately it's not behaviour you can change in the Appium Inspector.
That doesn't mean it stops you from identifying elements. You can click on the XML tree and open and look manually for your elements. If you found the right element in the tree, then you can check out the properties and work out the right XPath.
After that you can test the XPath by using the selector tester in the top menu of the Inspector.
New edit:
Automating between Native and WebView can be read here on appium.io. The elements you find in the inspector are probably in the WebView and you must switch to this in order for Appium to reach the correct elements.
Step 1: Print out all possible views through - this way you can retrieve what views there are and switch between them if you are in the app. Within hybrid apps, there are different views and you need to enter the correct one first in order to automate elements.
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context(contextNames.toArray()[INDEX]);
Step 2: Print the page source to get a scope of all elements in the currenct view through driver.getPageSource(). If you do this for all views you can see the possibilities and elements you have.

Related

Appium - Get actual, visible text that is displayed on screen

Appium
Python
iOS
el.text and get_attribute('label') etc. all seem to pulling accessibility information. Is there a way to pull the actual text that is displayed on screen using Appium? I need to be able to pull for a given element.
It does not return visible text if you use .text
You need to ask the developer to add a new attribute in the iOS code with the actual mention of the original url text. Then you will be able to see the new attribute in the Appium element locator table. If this is not done there is no value in the appium element locator table to give you the visible text
You can use .text
element = driver.find_element_by_class_name("class_name").text
print(element)
it will return you text and verify f you required.
Try this one it will help you
element = driver.find_element_by_class_name("class_name").get_attribute('text')
print(element)
or
Second one - Give you exact text from android ui
element = driver.findElementByAndroidUIAutomator("new UiSelector().className(\"android.widget.EditText\")").get_attribute('text')
print(element)
I am quite sure, that .text will give you the element's text when the element is visible.
Beware, Appium does give you an empty string here, if it deems the element not visible (out of screen- bounds or hidden or behind another element). If you need to get the text of elements which are not visible, you may try this one driver.find_element_by_class_name("class_name").get_attribute('textContent')

UI testing Xcode 7, How to get access to element in collectionview

I have an collectionview with invested ellements inside. The objects coming as images. So the problem is taping on these elements. I can`t pick elements from this window, and Accessibility Inspector showing my whole window with elements as button with missing accessibility values.
Image of Accessibility Inspector
So, if I am using just Record button, then I am getting this code, but it doesn`t work to play. I still have no lables and indexes.
XCUIApplication().childrenMatchingType(.Window).elementBoundByIndex(0).childrenMatchingType(.Other).element.childrenMatchingType(.Other).element.childrenMatchingType(.Other).element.childrenMatchingType(.Other).element.childrenMatchingType(.Other).element.childrenMatchingType(.Other).element.childrenMatchingType(.Button).element.tap()
Does anyone know, how to solve this problem?
Try to access control in following manner (better to debug and check value of each element in progressive manner using po)
[XCUIApplication.buttons elementBoundbyIndex:0]
Or
[[[XCUIApplication.windows elementBoundbyIndex:0] buttons] elementBoundbyIndex:0] ... so on.

Coded UI Test Builder assertions cannot access to DOM

I'm tring to make come UI test using Coded UI. Unfortuanley, It seems to not have access to all DOM elements in browser.
I want to assert value of one text block in form, and by"Add Assertion" the lowest element i can assert is form itself. All tags contained by form was flatten and putted to "id" property in "Add Assertion" widnows, like in the screen below:
Is there a way to assert only one tag in form? In this case i want to assert value "Szczegóły przesyłki: 0--1526203258"
It depends on how your web page is designed. From the image shown it it not clear what field contains the Szczegóły przesyłki: 0--1526203258. However, given (1) the scroll bar and (2) that the Id field is shown and is empty, it is probably the Inner Text field.
Given the number of lines shown above and below the required text you are likely to have selected a larger than necessary part of the screen. When creating an assertion is it often best to move the cross hairs tool around the screen to find the smallest control that contains the required field. Such a UI Control will have no child controls.
I have found that occasionally the Coded UI cross hairs tool loses its place and leaves all four (UP, DOWN, LEFT and RIGHT) arrows grey and inactive, as shown in the screenshot. When this happens try clicking the refresh button located between Add Assertion and the arrows. Some of the arrows should then be shown as black and active. If the DOWN arrow is grey (inactive) and some of the other arrows are black then the properties panel shows a UI Control that has no child components. You should be able to find a UI Control that contains only the required text.

Where is the combobox object in interface builder?

I just updated to Xcode 5.0.2 and in interface builder on the lower right corner where I can drag and drop objects I don't see combobox any more. I tried using the search field below and typed combobox, NSCombobox, but nothing.
Using a UIPickerView will probably get you far
It's easy to make a ComboBox lookalike. It consists of only three parts in InterfaceBuilder xib:
A Label for holding the selected choice. I've made it with a white background to look like an input field.
A graphic Button with an arrow
A ListView
The ListView is normally invisible (setHidden:TRUE) and is placed over other items in this xib.
A tap on the Button makes the ListView visible (setHidden:FALSE).
At selection, didSelectRowAtIndexPath writes the selected string to the label and set ListView hidden.
Combo boxes are available only for Mac projects, not iOS projects, so you're getting the expected behavior. If you create a Cocoa application project and type combo in the object library's search field, the combo box and combo box cell objects should appear in the object library.
I'm surprised you were able to access a combo box in earlier versions of Xcode. I don't remember combo boxes ever being available in iOS projects.
I also needed a HTML select-like control (single-selection dropdown list) without breaking the XCode legacy GUI interface across past and future iOS releases.
I ended up coding DownPicker, a lightweight control which does just that combining UITextField and UIPickerView. It can be used either as custom control (UIDownPicker) or also as control wrapper, upgrading any existing UITextField.
Here's how it looks like:
For more info and download you can check this brief tutorial or the GitHub project page (both made by me - the project is open-source).

How to a TFilterComboBox (drop down box) larger?

By default, when I click a Delphi TFilterComboBox it will display only 8 items. To access the rest of them, the user has to scroll down which is such a wast of time. Can I make it display more items (or even all of them)?
I have found an answer that says: "If you click the combobox in the resource template editor, you can drag its "opened" frame size to fit more items".
But I don't know what is this "resource template editor".
Normally one would like to use its DropDownCount property to set the maximum number of items visible in the dropdown window. But that seems to be hidden here (i.e. it is protected). I guess one can send it a message directly:
SendMessage(FilterComboBox1.Handle, CB_SETMINVISIBLE,
WPARAM(YourDropDownCount), 0);

Resources