Skip to content

Clicking on popup menu item does not take affect #317

@lrpowell

Description

@lrpowell

In traversing a web page, I need to select a pop-up menu item. I have not found a way for it to cause the click action to work.
I can get the correct DomElement/HtmlElement for the button, but selecting click(), dblClick() and other options still result in the same page. By default if right click is done on the icon where the menu list will appear, the first action in the list is launched. This does not work either.
I have tried looking at getOnClickAttribute() and getOnMouseOverAttribute() to see if it is defined as expected, but I get nothing back from thesee.
What else can I look at to determine what is needing to be done for the request to be acted upon?
Screen Shot 2021-02-20 at 1 29 35 AM

On the browser, I can hover over the icon and the Menu will pop up. Then I select "Investigate Data" to go to the next page (left mouse). Also right clicking on the icon causes this action to happen as it is the default for the icon.

When looking at this page xml, the button element with text "Investigate Data" is available with or without hovering or doing anything to the page. So I have also tried just selecting that button with a click().

I don't think it is a timing issue as I have tried several other options in the menu lists and many are not yet implemented so come up with a quick message saying that. I do not get other pages either when driving it with HtmlUnit.
I have also tried looping on waitingForBackgroundJavaScript to give it more time to come up.

There is only one window

Using the right click default:
```
String xpath = "//nav-menu-image";
String menuSearch = "Performance";

	webClient.waitForBackgroundJavaScript(10000);
	List<DomElement> navMenuList = htmlPage2.getByXPath(xpath);
	HtmlElement perfNavMenu = null;
	for (DomElement navMenu : navMenuList) {
		DomElement input = navMenu.getFirstElementChild();
		if (input.getAttribute("alt").equals(menuSearch)) {
			perfNavMenu = (HtmlElement)navMenu;
			break;
		}
	}
	HtmlPage menuPage =   perfNavMenu.rightClick();
	webClient.waitForBackgroundJavaScript(30000);

System.out.println("invData.xml:", menuPage.asXml());

Finding the button and going right to it:
		```
DomElement iDbutton = null;
		String buttonXpath = "//button";// [text()='Investigate Data']";
		List<DomElement> buttonList = menuPage.getByXPath(buttonXpath);
		System.out.println("Num buttons:" + buttonList.size());

		String taskSearch = "Investigate Data";// .."Investigate Data";
		for (DomElement button : buttonList) {
			if (button.asXml().contains(taskSearch)) {
				System.out.println("FOUND Investigate Data" + button.asXml());
				iDbutton = button;
				break;
			}
		}
		Page IDpage = iDbutton.click();
		webClient.waitForBackgroundJavaScript(10000);
		WebResponse newResp = IDpage.getWebResponse();

 <nav-menu-image _ngcontent-jbs-c117="" class="ng-tns-c114-945 ng-star-inserted"><input type="image" style="cursor: pointer; margin: 5px; height: 30px;" class="ng-tns-c114-945 ng-trigger ng-trigger-imgState" src="images/Performance.png" alt="Performance"></nav-menu-image>
<nav-menu-container _ngcontent-jbs-c117="" _nghost-jbs-c116="" class="ng-star-inserted"><div _ngcontent-jbs-c116="" class="menu-panel-container menu-panel-container-align-top" style="top: -64.5px;" hidden=""><div _ngcontent-jbs-c116="" class="menu-flyout-arrow-left menu-flyout-arrow-left-align-top" style="top: 79.5px;"></div><div _ngcontent-jbs-c116="" class="menu-panel"><div _ngcontent-jbs-c116="" class="inner-wrapper">

**<button _ngcontent-jbs-c116="" type="button" nav-placement="right" nav-append-to-body="true" class="menuItem ng-star-inserted" style="display: block; width: 100%; line-height: 1.5; margin-bottom: 5px;"> Investigate Data </button>**

<!----><!----><!----><!----><!----><!----><button _ngcontent-jbs-c116="" type="button" nav-placement="right" nav-append-to-body="true" class="menuItem ng-star-inserted" style="display: block; width: 100%; line-height: 1.5; margin-bottom: 5px;"> Manage Collections </button><!----><!----><!----><!----><!----><!----><button _ngcontent-jbs-c116="" type="button" nav-placement="right" nav-append-to-body="true" class="menuItem ng-star-inserted" style="display: block; width: 100%; line-height: 1.5; margin-bottom: 5px;"> Graph History </button><!----><!----><!----><!----><!----><!----><!----></div><div _ngcontent-jbs-c116="" class="menu-panel-title">Performance</div></div></div></nav-menu-container>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions