1

Currently developing automation against Salesforce using LeanFT v12.54 and Visual Studio 2012 (using C#). Working with Chrome Version 80.0.3987.149 (Official Build) (64-bit). On Windows 10.

I'm building an app model for the Contracts tab within Salesforce (specifically the Contract Documents) and have noticed that most of this section is contained within an iframe, which I can identify in the dev console using xpath ("//ARTICLE[normalize-space()='Contract Documents']//IFRAME").

In my C# code I'm instantiating a new object of Web.Frame() and then calling Find() using the above xpath but it's returning false:

var frame = new Web.Frame();
string xpath = "//ARTICLE[normalize-space()='Contract Documents']//IFRAME";
if (frame.Find(xpath))
    return true;
else
    return false;

Other notes: If I use the LeanFT Object Identification Center tool on this page it cannot penetrate any objects within the iFrame. I've been able to capture xpaths for elements within the iframe using Chrome dev tools but when I run them in the console they don't return any matches, unless I first expand the iframe element under the Elements tab, after which my xpath will return a match.

So I'm not sure why my Find() call is failing, and I need to find a way to interact with elements within the iFrame consistently using xpaths.

Edit: I've tried changing my C# code to instantiate a new object of type Web.WebElement instead of Web.Frame and using the same xpath it's able to find it as a WebElement but not as a Frame.

pchittum
  • 313
  • 3
  • 9
  • Salesforce aggressively attempts to prevent allowing any of their standard interface to be iframed into another app. You could be bumping into this. Is there a reason you don't want to do a data-level integration? – pchittum Mar 24 '20 at 11:24

1 Answers1

0

var frame = new Web.Frame(); is just an empty Frame, no wonder frame.Find returns nothing.

The instantiation of the Frame needs to be accompanied by the frame description, a unique one, and only then will you be able to Find anything in it

Adelin
  • 7,809
  • 5
  • 37
  • 65
  • We do that via our Find() by passing in an xpath which uniquely identifies the object and then creating an Element object using browser.Describe and our xpath. Basically we always use Find(xpath) to locate the element and only after that comes back true do we proceed to do anything else with the object. – br0k3nglass Mar 26 '20 at 16:02
  • `Find` works inside the `Frame` you described. in your case, an empty frame, which has nothing in it, so `Find` of anything will not return any results – Adelin Mar 26 '20 at 16:12