How to access element inside iframe in Java?



  • enter image description here

    I want to get an element's id attribute that is inside of an iframe through Java. How do I access an element inside of an iframe in Java?



  • In my experience the simplest way to manipulate elements inside of an iframe with web automation is to treat the iframe src URL as a separate page and call the driver to visit that URL instead of the parent page. From the example in the screenshot, I would have an automated step that would visit the URL in the src attribute of iframe#ComposeRteEditor_surface... (the actual src attribute wasn't visible in the screenshot), then I would call the appropriate step or findElement() function as normal.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2