Selenium and Navigation items

Does anyone have experience using Selenium to test clicking on Navigation items in a Navigation Tree widget in Mendix? I'm having a really hard time, as I can get the items for the Tree or for the individual <a> tags of the links, but trying to click them in Selenium returns errors because they are not 'visible'. Even if I wait until well after the page was loaded, it is still not successful. I can successfully click on links in the pages and it seems to work just fine, but clicking on the Navigation items is causing me real problems. Does anyone know the proper way to go about this?
3 answers

Which level of the tree are you trying to click?
Lower-level nodes are not visible until you click their parent node.


Have you checked whether the nav-tree is in the DOM just once? You might actually be targetting a different html-element.

An example where the nav-tree is rendered twice is the basic Sidebar_FullResponsive layout.
Both are available in the DOM, but one of them is hidden/off screen depending on your screensize.



Selenium is a portable software-testing framework for web applications. Selenium provides a playback (formerly also recording) tool for authoring tests without the need to learn a test scripting language (Selenium IDE). ... The tests can then run against most modern web browsers.

Navigate To Command

to(String arg0) : void – This method Loads a new web page in the current browser window. It accepts a String parameter and returns nothing.

Command – driver.navigate().to(appUrl);

It does exactly the same thing as the driver.get(appUrl) method. Where appUrlis the website address to load. It is best to use a fully qualified URL.


1  driver.navigate().to("");

Forward Command

forward() : void – This method does the same operation as clicking on the Forward Button of any browser. It neither accepts nor returns anything.

Command – driver.navigate().forward();

Takes you forward by one page on the browser’s history.


1  driver.navigate().forward();

Back Command

back() : void – This method does the same operation as clicking on the Back Button of any browser. It neither accepts nor returns anything.

Command – driver.navigate().back();

Takes youback by one page on the browser’s history.

1  driver.navigate().back();

Refresh Command

refresh() : void – This method Refresh the current page. It neither accepts nor returns anything.

Command – driver.navigate().refresh();

Perform the same function as pressing F5 in the browser.


Practice Exercise

  1. Launch new Browser
  2. Open website
  3. Click on Registration link using “driver.findElement(By.xpath(“.//*[@id=’menu-item-374′]/a”)).click();
  4. Come back to Home page (Use ‘Back’ command)
  5. Again go back to Registration page (This time use ‘Forward’ command)
  6. Again come back to Home page (This time use ‘To’ command)
  7. Refresh the Browser (Use ‘Refresh’ command)
  8. Close the Browser