Menu Layout button on Appian Selenium

How to click on the above Menu Layout Button? using the Appian Selenium 

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    Hi  ,

    Identify a Unique XPath/CSS Selector for the Menu Layout Button.

    Check the following Selenium code if you are trying to test or using RPA:

    WebDriver driver = AppianObjectRepository.getWebDriver();
    
    WebElement menuButton = driver.findElement(By.xpath("//button[contains(@class, 'Button---secondary') and contains(@class, 'Button---small') and contains(@class, 'Button---with_icon')]"));
    menuButton.click();
    

    If it's RPA, then you can refer this link - Browser Java Module

    Note: The above code is just for reference, identify exact relative xpath !!!

  • 0
    Certified Lead Developer

    Identifying a button in Appian using Selenium can be more challenging than in traditional applications because Appian generates its UI dynamically and many CSS classes can change frequently. Here are some effective and stable ways to locate buttons:

    1. Locate by visible text
    If the button has visible text, you can use XPath:

    driver.find_element(By.XPATH, "//button[normalize-space()='ButtonName']")

    If it’s not a <button> element but a <div>, <a>, or similar:

    driver.find_element(By.XPATH, "//*[text()='ButtonName']")

     2. Use stable attributes
    Look for attributes like:

    aria-label

    title

    id (if not dynamic)

    data-*

    Example:

    driver.find_element(By.CSS_SELECTOR, "[aria-label='Save']")

  • The Appian Selenium API has javadocs in the download. Have you tried the following?

    • clickOnRecordActionFieldMenuAction

      public void clickOnRecordActionFieldMenuAction​(java.lang.String indexOfField, java.lang.String action)
      Click a specified action inside a record action field with styling of MENU or MENU_ICON
      FitNesse Example: | click on record action field | [INDEX] | menu action | ACTION_NAME or [INDEX] |
      Parameters:
      indexOfField - The index of the record action field out of all record action fields on the page
      action - The action from the dropdown that the user wants to click on