1

In a web app that we are testing using LeanFt, there is a type button object with the tag (EDL-FILE-UPLOAD). A dialog to browse the file system and upload a file must pop up when this button is clicked. This happens when the button is clicked manually.

But when I try the .click() or .doubleClick() methods in my LeanFt automation script, nothing happens. Now this button has a web element child that displays the label. So i tried XPathDescriptions for the webElement, and tried the findChildren() function as follows


    WebElement[] h = browser.describe(Button.class, xPathDescriptionOfButton).findChildren(WebElement.class, xPathDescofWebElement)

    for(int i=0;i<h.length;i++) {
                    h[i].click();
                    h[i].hoverTap();
                    h[i].longPress();
                    h[i].doubleClick();
                    h[i].click(MouseButton.LEFT);
                    h[i].fireEvent(EventInfoFactory.createMouseEventInfo(MouseEventTypes.ON_CLICK));
                    h[i].fireEvent(EventInfoFactory.createEventInfo("click"));
                }

None of the above led to the dialog for uploading files popping up.

Is there any other way to make sure that the button is clicked, and the dialog pops up using Java+LeanFt?

Thank you.

1 Answers1

0

I have been able to solve this issue by using the Robot class to perform mouse click and release actions on the co-ordinates of the button.

            Robot r=new Robot();
            r.mouseMove(xCoordinate, yCoordinate);
            r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);