Handle Iframe
Facing problem with iFrames
I have Iframe id but Not able to find path for internal element of an Iframe where I need to perform click event. How can can i do the same.
while performing inspect on browser I can see tthe path for internal element.
is it right to create object for that Iframe by using Name mapping and then use findchildXpath method on that object and provide xpath for all webelement that need to perform ?
Hi kaiiii,
There are some things you should be aware of when accessing objects inside iframe. They are listed in the Considerations for Web Testing help article. Let me quote them here:
-
With the default security settings Chrome follows the same-origin policy and does not allow cross-origin interaction. Because of this, TestComplete cannot access the contents of cross-origin framesets (when a host of an HTML frame differs from the host of the parent page). To test the contents of such framesets, you need to open the contained frame as a separate web page or launch the Chrome application with the following command-line switches:
--disable-web-security
(for all Chrome versions)--user-data-dir=<ProfilePath>
(for all Chrome versions)--disable-site-isolation-trials
(for Chrome version 70 and later)The same-origin policy also applies to framesets displaying local files. By default, the local files are considered to belong to different origins and not allowed to access one from another. To solve the latter issue, you can launch the Chrome application with the
--allow-file-access-from-files
command-line switch.The --disable-web-security
,--disable-site-isolation-trials
and--allow-file-access-from-files
command-line switches impair the browser security. We do not recommend using these switches unless required by your testing needs. -
To execute the JavaScript
eval
function on a web page frame in Chrome, you need to use a specific syntax that includes the frame ID. See Executing JavaScript in Frames in Google Chrome.
Does it help?
-