cancel
Showing results for 
Search instead for 
Did you mean: 

Web dropdown menu

SOLVED
mikileung
Occasional Contributor

Web dropdown menu

Hi, 

 

I am trying to write a script (Python) to 

- click the down arrow button 

- select one of the options in the drop down menu. 

Here is my script. It failed with the log saying "The object does not exist. See Details for additional information."

I am a Python beginner, it would be great if someone can help. 

 

mikileung_1-1612368354089.png

 

def my_test():

p = Aliases.browser.pageLogon.sectionShellSplitCanvas.frameApplicationActivitytypeMana.frameIframeid.textbox_activityTypeCat
p.Click()
my_choice = page.Find("contentText","Manual entry, manual allocation",10,True)
my_choice.Click()

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mikileung
Occasional Contributor

Re: Web dropdown menu

Thanks 

 

I have changed the p to narrow down the search area. I managed to find the object but now it says There was an attempt to perform an action on a zero-sized window. 

The drop down list does not hold up, which it is very hard to map the object. That is why I used the find object method. If I map the object with the object spy, it would say the object is not under the object tree. 

 

Is there a way to solve this problem? 

 

Here is my adjusted code, 

def my_test():
# Find all enabled buttons in the Replace dialog
p = Aliases.browser.pageLogon.sectionShellSplitCanvas.frameApplicationActivitytypeMana.frameIframeid.activityTypeCat_dropdown_var
my_choice = p.Find("contentText","Manual entry, manual allocation",2,True)
if my_choice.Exists:
Log.Message("FOUND IT!")
my_choice.Click(-1,-1)
else:
Log.Message("Cannot find the menu option")

 

View solution in original post

2 REPLIES 2
BenoitB
Community Hero

Re: Web dropdown menu

It failed after doing the click ?

 

Several possibilites:

- find depth not enough (check object Spy)

- using xpath

- sometimes the windows underlying the drow down is not at page level

- use selectItem or Item(x) or whatever method of this kind linked to dropdown object (check object spy, Methods tab)

 

 

Un sourire et ça repart

mikileung
Occasional Contributor

Re: Web dropdown menu

Thanks 

 

I have changed the p to narrow down the search area. I managed to find the object but now it says There was an attempt to perform an action on a zero-sized window. 

The drop down list does not hold up, which it is very hard to map the object. That is why I used the find object method. If I map the object with the object spy, it would say the object is not under the object tree. 

 

Is there a way to solve this problem? 

 

Here is my adjusted code, 

def my_test():
# Find all enabled buttons in the Replace dialog
p = Aliases.browser.pageLogon.sectionShellSplitCanvas.frameApplicationActivitytypeMana.frameIframeid.activityTypeCat_dropdown_var
my_choice = p.Find("contentText","Manual entry, manual allocation",2,True)
if my_choice.Exists:
Log.Message("FOUND IT!")
my_choice.Click(-1,-1)
else:
Log.Message("Cannot find the menu option")

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors