How to catch a text generated in dropdown list

Asked by Sikulipro

When i fill a form it generates a runtime id,
ex. 001, same id displays in a drop down, so what i required i want to find 001(runtime generated id) in dropdown using 'find'or exist. this is pure Sikuli question.

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Sikulipro (saindane-harshal) said :
#1

This id by default displays in dropdown, just want to find that id is displaying or not in that drodown

Revision history for this message
Eugene S (shragovich) said :
#2

Hi,

Not sure I understand the question, you have some kind of id generated and then you want to see that this exact id also appears somewhere else (dropdown)?

If yes, do you know exactly what you expect to see there (in the dropsown)?

Revision history for this message
Sikulipro (saindane-harshal) said :
#3

Yes, Eugene I expect same id in that dropdown, it will bydefault selected in that drpdown . Just to check that displayed is correct or not.

Sent from Yahoo Mail on Android

Revision history for this message
Eugene S (shragovich) said :
#4

So, as far as I understand the problem, there might be 2 possible solutions:

 1. If you have the SIMILAR id generated elsewhere on the screen, you can just take a screenshot of it and later just to search for the same image later, when you open your dropdown menu.

 2. Try tio use the OCR features. Although it can be a headache, in some cases you might get fairly consistent results.

Please update on your progress.

Cheers,
Eugene S

Revision history for this message
Sikulipro (saindane-harshal) said :
#5

Thats right Eugene , but the problem is that id displayed in dropdown will be change every time, and an id will generate would be a normal text which we can copy with double and id displayed on dropdown can not be copy .

Revision history for this message
Eugene S (shragovich) said :
#6

So again, as I said, you can create a pattern from the first (generated) id and then use it to find the second one on the screen.
For example:

# locate the generated id on the screen and create a pattern
generatedID = capture(generatedIDregion)
generatedIDPattern = Pattern(generatedID)

"""
Some code to open the dropdown menu
"""

# once the dropdown menu is showing, search for the same pattern we created earlier
try:
    dropDownID = find(generatedIDPattern)
    dropDownID.highlight(1)

Otherwise, copy the generated ID and keep in a variable and then use OCR to read the dropdown id. Then compare it.

Can you help with this problem?

Provide an answer of your own, or ask Sikulipro for more information if necessary.

To post a message you must log in.