LeanFT : Browser control not switching to new tab to perform user actions

  • Questions
  • LeanFT : Browser control not switching to new tab to perform user actions
Question ID: 107291

Using LeanFT, when I clicked on any link in the opened browser (1st tab) it opens a new tab in the same browser but actions are not performing on the newly tab(2nd tab), basically browser control is not switching to new tab to perform execution,

browser = BrowserFactory.launch(BrowserType.FIREFOX);
browser.describe(Link.class, new LinkDescription.Builder().innerText("TEXT").build()).click();
Browser aboutTab = BrowserFactory.attach(new BrowserDescription.Builder().title("TITLE").build()).click();
aboutTab.describe(Link.class, new LinkDescription.Builder().innerText("text").build()).click();

throws exception,
com.hp.lft.sdk.ReplayObjectNotUniqueException: attachApplication

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on December 4, 2016 7:44 am
Answers (1)
Private answer

Take a look at [http://leanft-help.saas.hp.com/en/12.54/HelpCenter/Content/CodeSamples_Java/codeex_Web.htm?Highlight=BrowserFactory.attach#hp-minitoc-item-1][1]

This should help you format your code so that it works. They key part is to get the description correct for the 2nd tab as it shows in the example code...

// Attach the new (replacement) browser tab.

Browser aboutTab = BrowserFactory.attach(new BrowserDescription.Builder().title(''Cruises: Mercury Tours'').build());

// Create a description for the page title.

WebElement aboutTitle = aboutTab.describe(WebElement.class, new WebElementDescription.Builder().tagName(''LI'').innerText(''Cruises'').index(0).build());

[1]: http://leanft-help.saas.hp.com/en/12.54/HelpCenter/Content/CodeSamples_Java/codeex_Web.htm?Highlight=BrowserFactory.attach#hp-minitoc-item-1

Marked as spam
Posted by (Questions: 16, Answers: 749)
Answered on December 9, 2016 7:42 pm