taiko icon indicating copy to clipboard operation
taiko copied to clipboard

Facing issue while accessing elements within Iframe

Open selvaganesan2005 opened this issue 2 years ago • 2 comments

We are testing an UI app (Technology - Angular) which has "Iframe" elements. There is a #document(html ->body-.>div->input) structure inside the Iframe . We need to access the textbox elements inside the html structure within the Iframe. These elements are not located when we tried to access it using taiko (used different locators such as visible text, Id , relative & full xpath). Please help us resolving this issue. taiko version is 1.3.2.

selvaganesan2005 avatar Oct 11 '22 11:10 selvaganesan2005

Have you tried the $ selector? You can pass it a function that uses the native DOM api.

What I would try is to pass in a function that uses document.querySelector("iframe").contentDocument.querySelector("input[type='text']") to get a handle on an element within an iframe and try manipulating that?

marques-work avatar Dec 03 '22 12:12 marques-work

@selvaganesan2005 I was facing the same issue a while ago. I could just solve this issue by running the tests in headless mode in which I had no problems accessing elements inside an iframe. But we could not solve the issue to access the elements in headful mode.

ghost avatar Dec 10 '22 18:12 ghost