Forum Discussion

SK2's avatar
SK2
Contributor
2 years ago
Solved

How to access iFrame objects in chrome browser using TestComplete

I am working in Salesforce application. Here is my scenario:

Opens Salesforce application

Navigate to setup and select one of the user profile

Now, I need to click on the Login button within the profile. However, this button is within an iFrame hence TestComplete unable to identify it.

  • Hey SK2

     

    Ok, so that's a step in the right direction! 

     

    Those backslashes are going to be required when executing this in the IDE as Python code, we just needed to remove them for basic CLI interaction. 

     

    For Python and the TC IDE, you will receive that error if you do not have the indentions correct. I would make sure you're indenting properly, and add those slashes back.

     

    For instance, this is how I have mine setup and launches Chrome without any popups.

     

21 Replies

    • SK2's avatar
      SK2
      Contributor

      Hi Nick,

      As stated in the link above I have entered below line in the command-line, however receiving pop up window as "Failed to Create Data Directory". I am assuming some permission issue.

      "--disable-web-security --user-data-dir=\"C:\\Users\\Tester\\AppData\\Local\\Google\\Chrome\\User Data\\Default\" --disable-site-isolation-trials"

       

       

  • SK2's avatar
    SK2
    Contributor

    Hi Nick,

    Looks like this issue is not completely resolved. I can open the chrome browser with my code, however I still get the dialog box with Failed to Create Data Directory message while executing my script but once I manually click on OK button then the script continues and enters the URL that open the browser with disabled security version and it performs other actions and access the iFrame object as well.

    Browsers.Item("chrome").RunOptions = "--disable-web-security --user-data-dir=\"C:\Users\MyUser\AppData\Local\Google\Chrome\User Data\Default\" --disable-site-isolation-trials";
    Browsers.Item(btChrome).Run("myAppURL");

    FYI - bold text has real data

    • SK2's avatar
      SK2
      Contributor

      Does anyone has any resolution for my issue above? I am adding my query again below:

      I can open the chrome browser to access iFrame with my code, however I still get the dialog box with 'Failed to Create Data Directory' message but once I manually click on OK button the script continues and enters the URL that open the browser with disabled security version and it performs other actions and access the iFrame object fine. However, how can I avoid getting the dialog box in the beginning?

      Browsers.Item("chrome").RunOptions = "--disable-web-security --user-data-dir=\"C:\Users\MyUser\AppData\Local\Google\Chrome\User Data\Default\" --disable-site-isolation-trials";
      Browsers.Item(btChrome).Run("myAppURL");

      FYI - bold text has real data

       

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        If you google this:

        google chrome cannot read and write to its data directory

         

        there are many different suggestions for a fix. I don't know which one(s) would work for you.

  • Hey SK2,

     

    I'm very sorry for the confusion, all of my code samples have been in Python, not JS. 

     

    Unfortunately the iFrame JS example is working as expected on my machine by simply swapping out the username as we discussed. This does open Chrome with the correct settings to identify objects in frames within Salesforce. 

     

    I might move forward here by taking a step back and going over the documentation one more time and try the sample again. If you still receive the error about creating the user data information I would take a hard look at the permissions of your machine. Getting this to launch from the CLI with the required flags would be a good start to eliminate TestComplete from the troubleshooting process. 

     

    Accessing Object Frames in Chrome and Edge;

    https://support.smartbear.com/testcomplete/docs/app-testing/web/common-tasks/frames.html