Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findLabelAtIndex with iOS sets type "XCUIElementTypeStaticText" #17

Closed
scsmith5593 opened this issue Jul 25, 2019 · 4 comments
Closed
Labels
enhancement New feature or request in progress This issue is being worked on currently

Comments

@scsmith5593
Copy link

Hi,

Having a problem with findLabelAtIndex. I've created a new Label TestObject with type=XCUIElementTypeImage and name=detail-disclosure (as those are the type and name of the objects in the list I'm testing). When I run my test using findLabelAtIndex, the element isn't found and I see in the logs:

[35m[HTTP]�[39m �[90m{"using":"xpath","value":"(//[@type='XCUIElementTypeStaticText' and @name='detail-disclosure'])[6]"}�[39m
WARNING: Logger is not initialized. No log file will be written.
Would have logged:
Could not find any list elements matching xpath: (//
[@type='XCUIElementTypeStaticText' and @name='detail-disclosure'])[6]

Not sure where XCUIElementTypeStaticText came from or why it's not using the type I set in the object: XCUIElementTypeImage.

Katalon Studio version: 6.2.2
Appium Version: 1.12.1

Thanks for any help/further info you can provide.

@ctrevarthen
Copy link
Contributor

Hi @scsmith5593 ,

Thanks for reaching out!

The apps I've been testing have the labels as text, instead of images, so when the library looks for labels, it's assuming text.

We should be able to add functionality to look at the element type when an existing Test Object is provided.

@ctrevarthen ctrevarthen added the enhancement New feature or request label Jul 26, 2019
@scsmith5593
Copy link
Author

Hi, Chris,

Got it. I thought that might be the case. Thanks.

ctrevarthen added a commit that referenced this issue Jul 31, 2019
Create enum for object types to make logic for type checking easier.
@ctrevarthen ctrevarthen added the in progress This issue is being worked on currently label Jul 31, 2019
@ctrevarthen
Copy link
Contributor

ctrevarthen commented Jul 31, 2019

Hi @scsmith5593 ,

If you want to check out version 1.13.0, I think it will address the issue you saw with finding image elements at an index: https://github.com/detroit-labs/katalon-mobile-util/releases/tag/1.13.0

https://github.com/detroit-labs/katalon-mobile-util#finding-an-element-from-a-list-by-index

Specifically, now you would use something like this:

import com.detroitlabs.katalonmobileutil.testobject.TestObjectType

int index = 3 // first element in the list is at index 1, so this gets the 3rd element
TestObject imageAtIndex = Finder.findElementAtIndex(TestObjectType.IMAGE, 'Generic image element', index) 

Please let me know if you have any issues getting this to work for your situation.

@scsmith5593
Copy link
Author

Hi,

I tried it out and it works just as expected--thanks! Very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress This issue is being worked on currently
Projects
None yet
Development

No branches or pull requests

2 participants