Cannot robustly locate button within iframe

I am trying to click on a button which is inside an iframe which has a dynamic id.

I have gone around in ever decreasing circles and nothing is working (tried switch to frame and various other things)

The test recorder will see the button, but because the name of the iframe is dynamic it will not be able to find it the next time the test is run.

I have tried using a wildcard for the CSS selector to rep[lave the dynamic part of the id with an asterisk but that doesn’t work.
This is what I do know so far:

  • The xpath to the iframe comes up as: either //iframe

  • the dynamic css selector is: *[id = 'com.redmoon.customfields.jira__project-field-creator__[asterisk]] (with the asterisk/part after the double underscore denoting the dynamic part of the id which is a few letters and numbers)
    For example the current instance when i look at its id attribute is : ‘com.redmoon.customfields.jira__project-field-creator__2c5006f9

The button I am trying to click on has an xpath of : /html/body/div[1]/section/div/div[1]/div[1]/button

  • however sometimes the button attribute changes from div[1]/div[1]/button to div/div[1]/button

can anyone help me with how I can identify this object and click on it through different test sessions?

I have numerous other iframe elements which work fine, its just this one button.

I have AI element location turned on.

Hi @kim,
Is this site public, are you able to share the URL of this page and button you are trying to click on?