How to select option from PopUp menu?

On a web page, my goal is to click on a Report Grid item, click on the PopUp menu (with only 1 option ‘View Report’) and that should bring up another dialog box to populate Drop Down with ‘CSV’ and click a ‘Generate Report’ button.

I am unable to click ‘View Report’ pop up menu option. I do the following:

  1. WebAutomation.WebPageContainsText…

  2. WebAutomation.HoverOverElement…

  3. WebAutomation.ClickPressDialogButton…DialogButton: ‘View Report’ # this should work but it’s not. The desired report item (=Control) is highlighted but code is not clicking on the popup menu option ‘View Report’

  4. WebAutomation.Click on ViewReport control # this is extra click

I can’t click ‘View Report’ context/popup menu option.

How can i select the PopUp menu option? I thought ClickPressDialogButton would work.

Thank you,

1 Like

Hi @mai1701, it’s difficult to make a useful suggestion without knowing more details.

But as you do mention a popup menu, you might try creating another appmask screen for the popup menu itself, and then a control on that screen for ‘View Report’. Then use ‘WebAutomation.Click’ on that control.

Sorry if this is not helpful, but I’m shooting in the dark here.

Regards,
burque505

1 Like

I will try your suggestion. I appreciate your reply.

Thanks,

1 Like

@mai1701 on top of @burque505 answer, in case you are using Chrome browser, please check whether the popups are blocked or not.

image

1 Like

I’m using IE. I see the PopUp menu but the code is not clicking it. I already added several screens and tried different click commands and different wait time:

WebAutomation.HoverOverElement (list item)
WebAutomation.ClickPressDialogButton (control = report list item, diaglog Button: ‘View Report’
WebAutomation.Click (control = viewreport menu option)

If I manually click ‘View Report’ then the rest of the script downloads a file (xlsx format) and completes successfully.

I think there should be more sample code. Each method/function needs sample code.

My 2nd issue is I am unable to set the Report Format drop down list to CSV so I bypass this field and XSLX (default) is used. I tried 3 things here: FormFillingSetDropDownListValuesbyNames, by index, PopulateTextField. PopulateTextField shows CSV in the field but not truly setting field to CSV so xlsx is downloaded. The 2 SetDropDownListValues don’t work.

It should not be this hard.

Thank you,

1 Like

@mai1701, are you perhaps able to click on the offending button with Javascript?

With no ability to test this, and assuming the viewReport element has an ID:

WebAutomation.ExecuteJavascript     BrowserInstance:  Browser \
                                    Javascript: \
                                    """
                                    function ExecuteScript()  
                                    {document.getElementById("viewReport").click(); }
                                    """ \ 
                                    Result=> Result 

I know this is frustrating, keep at it.

Regards,
burque505

Thank you so much for your reply. I’m trying now. I got run time error “L75:0 Failed to execute Javascript function on web page”



I will set id to viewReport in other screens and run. We’ll see.

Thanks,

1 Like

Hi @mai1701, my use of ‘viewReport’ was only as an example. Unless UiSpy gives you a selector with the ID viewReport (which I doubt, but maybe :grinning:), you will need to to use a selector you get by examining the webpage HTML. On the webpage itself, right-click on the “View Report” button, and click “Inspect”.

I recommend not using IE for that part, use Chrome or Firefox if you can (better developer tools). If you have Chrome, you can install an addon called ChroPath that makes it easy to get selectors.

I’m sorry if I’m not being more help. Without being able to inspect your webpage source myself, I’m really just stumbling around blind. You might have a look at this guide by @jokoum which may get you started.

Regards,
burque505

3 Likes

Hello @burque505, from your suggestion, I was able to download in CSV format by using JavaScript to set the value of the Element to CSV and click(). I’m still working on the ‘View Report’ popup.

Thanks,

1 Like

Hi @mai1701, I’m glad you’re having some success.

Regards,
burque505