3

screenshot Issue: I am trying to access the webelement(logout) highlighted in blue using htmlunitdriver. The requirement is to find the element on smart client GUI and click on it.

Approach: The approach followed for accessing element inside the page is to first find the desired iframe, switching to it and then accessing the webelement(logout) highlighted in blue.

Solution: No error is found while switching to frame but whenever we try accesing any elements inside the frame, the error is encountered:

"Element not found"

My question is, are we following the correct approach? If yes, why is the element is accessible? Various solutions were tried (until now) listed below:

  1. Tried switching to frame using various locators such as index, id/name, webelement, no error encountered but objects of page are not found even after switching.

  2. Tried with firefox for accessing the number of links for the xpath of logout using "contains" keyword and it gives the size as 5 while the same feature is not reproducible with htmlunit driver.

  3. Tried switching to iframe, no error found but elements are not accessible

  4. Tried with driver.switchTo().defaultContent() before switching to frame.

  5. Updated the selenium and html unit driver to latest version

  6. Tried driver.setJavascriptEnabled(false) but not able to proceed further when javascript is disabled.

  7. Tried accessing other frames as well but no success

  8. Tried increasing the wait time extending it to 5 minutes, also tried explicit wait utility of webdriver.

  9. Tried various locator along with accessing the element with absolute xpath, but getting no such element found exception

  10. Tried “refresh” utility after waiting for page to appear but getting error

    (TypeError: Cannot find function addEventListener in object [object HTMLDocument].

  11. Just for the sake of trying we also found current window handle and switch to it before switching to frame but no success yet.

Please find the DOM structure attached for the reference

Dom structure

T3 H40
  • 2,326
  • 8
  • 32
  • 43
ivory
  • 31
  • 2

0 Answers0