Firefox profiles opening via database data success but too many empty ffox windows remain open?

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable as GlobalVariable

import org.openqa.selenium.WebDriver

import org.openqa.selenium.firefox.FirefoxDriver

import org.openqa.selenium.firefox.FirefoxOptions

import org.openqa.selenium.firefox.FirefoxProfile

import org.openqa.selenium.firefox.internal.ProfilesIni

import com.kms.katalon.core.webui.driver.DriverFactory

import com.kms.katalon.core.webui.driver.WebUIDriverType

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.openBrowser(’’)

WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()

switch(executedBrowser) {

case WebUIDriverType.FIREFOX_DRIVER: // “Firefox”

ProfilesIni profile = new ProfilesIni();

FirefoxProfile FF = profile.getProfile(username);

FirefoxOptions options = new FirefoxOptions().setProfile(FF);

WebDriver driver = new FirefoxDriver(options);

// let Katalon Studio to use the WebDriver created here

DriverFactory.changeWebDriver(driver)

break

}

WebUI.maximizeWindow()

WebUI.navigateToUrl(‘https://www.youtube.com’)

WebUI.closeBrowser()

execution

  1. empty ffox browser opens (remains open till the end)

takes time to open profiles approx 30 sec - 1 min…

  1. The profiles opens from firefox which are the gmail profile (browser)

  2. browser closes then reopens with empty profile

  3. new profile opens …

and then steps 3 -4 repeats till it finishes my profiles.

so the question is why is there step 1 or 3 i.e empty ffox opening and remains open ?

also why time lag ?

You have a line “WebUI.openBrowser()”. This line is unnecessary. This line opens one more FireFox window, and it remains opened after another FireFox window is closed by WebUI.closeBrowser().

You should remove the line as follows:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI/* WebUI.openBrowser('') */WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()
1 Like

i had tried removing it …but then firefox wont launch ( nothing launches )

finally solved it by removing …
WebUI.openBrowser(’’) & by adding gecko-driver path !

System.setProperty(‘webdriver.gecko.driver’, DriverFactory.getGeckoDriverPath())

can you pls guide me hope to speed up the launch of the firefox browsers?

thanks :slight_smile:

one more question i was unable to see profiles in firefox when i added selenium. for xpath , instead of webui. functions .
what do i need to do ?

so im currently using sikuli which seems to have problems or bugs !! plz check below

import internal.GlobalVariable as GlobalVariable

import java.io.IOException;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.WebDriverWait;

import org.sikuli.script.Key;

import org.sikuli.script.Screen;

import org.sikuli.script.Pattern;

import org.sikuli.script.FindFailed;

WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()

switch(executedBrowser) {

case WebUIDriverType.FIREFOX_DRIVER: // “Firefox”

System.setProperty(‘webdriver.gecko.driver’, DriverFactory.getGeckoDriverPath())

ProfilesIni profile = new ProfilesIni();

FirefoxProfile FF = profile.getProfile(username);

//FirefoxOptions options = new FirefoxOptions().setProfile(FF);

FirefoxOptions options = new FirefoxOptions();

options.setProfile(FF);

WebDriver driver = new FirefoxDriver(options);

// let Katalon Studio to use the WebDriver created here

//FirefoxDriver driver = new FirefoxDriver(options);

DriverFactory.changeWebDriver(driver)

break

}

WebUI.maximizeWindow()

Screen s = new Screen();

Pattern image1= new Pattern(’/Users/adam/Desktop/katalon sikuli images/search .png’)

Pattern image2= new Pattern(’/Users/adam/Desktop/katalon sikuli images/hari .png’)

WebUI.navigateToUrl(‘https://www.youtube.com’)

WebUI.delay(5)

s.click(image1,10) //THIS IS DOING RIGHT CLICK INSTEAD OF CLICK. ???

WebUI.delay(5)

s.type(“simba”) // THIS ISNT TYPYING ANYTHING ???

s.doubleClick(image2,5)

WebUI.delay(5)

WebUI.closeBrowser()

I do not know sikuli script at all. I can not help.

ok no prbs :slight_smile:
thanks