I have to interact with already an opened browser and perform few clicks, Page navigation and read text from form controls. Can LeanFT has the capability to do so?
-
1Yes, it does. Browser.Attach – Adelin Jan 17 '19 at 08:11
-
@Adelin this should be an answer – Motti Jan 17 '19 at 09:41
-
1@Motti but by answering I feel like I'm encouraging such poor questions, answers to which are a matter of checking LeanFT's official capabilities. – Adelin Jan 17 '19 at 10:26
-
@Adelin, on the one hand you're right, on the other hand by answering such a question the answer is now googleable so the next person searching for this will find it more easily. – Motti Jan 17 '19 at 11:19
-
@Motti ok - I couldn't just post an answer stating such obvious feature, so I generalized a bit... – Adelin Feb 07 '19 at 11:28
-
1@Adelin I applaud your integrity, good answer too. – Motti Feb 07 '19 at 12:08
1 Answers
LeanFT can do that, and then some...
Basically, for LeanFT, almost anything can be discovered and interacted with. They do that via what they call an element Description
.
It understands native technologies like Java, WPF, WinForms, Powerbuilder, Mobile, etc. and, obviously, Web.
In your case, you'd have to work with com.hp.lft.web
package, which contains everything needed to discover anything web related, be it browsers, buttons, media elements, etc.
And, as already mentioned, you need to describe those elements via a description.
The parent element, the browser
, can be reached in 3 ways, all by making use of the BrowserFactory
class:
- launching a browser:
BrowserFactory.launch
with the type of browser to launch - attaching to an already opened browser:
BrowserFactory.attach
with a description - getting all opened browsers:
BrowserFactory.getAllOpenBrowser
with a description
All these methods will return instances of Browser
, which have ways to further control a browser.
You can find samples of these methods in LeanFT's official documentation.
For visibility, I'll post the relevant attach
sample:
Browser aboutTab = BrowserFactory.attach(new BrowserDescription.Builder().title("Cruises: Mercury Tours").build());

- 7,809
- 5
- 37
- 65