Cannot close pop up window in firefox(chrome works fine)

hello, i am having issue with closing a pop up in firefox. please help. it seems that the iframe window in chrome and firefox is named different. when i capture the objects the test case works fine and passes in chrome, but fails in firefox.

chrome script is

WebUI.openBrowser('staging2-web.partycity.com/')

WebUI.switchToFrame(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/iframe_Live chat_fpw-view'), 
    10, FailureHandling.STOP_ON_FAILURE)

WebUI.waitForElementVisible(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/div_ILL PAY FULL PRICE'), 
    10, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/div_ILL PAY FULL PRICE'), 
    FailureHandling.STOP_ON_FAILURE)

when i run under firefox it fails and failure is

Unable to verify image 'Object Repository/Page_Online Party Store with over 850 Store Locations  Party City/iframe_Live chat_fpw-view' present (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to verify image 'Object Repository/Page_Online Party Store with over 850 Store Locations  Party City/iframe_Live chat_fpw-view' present
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.switchToFrame(SwitchToFrameKeyword.groovy:84)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.execute(SwitchToFrameKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.switchToFrame(WebUiBuiltInKeywords.groovy:2850)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$switchToFrame$0.call(Unknown Source)
	at close pop up c.run(close pop up c:19)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1569260079444.run(TempTestCase1569260079444.groovy:21)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/Page_Online Party Store with over 850 Store Locations  Party City/iframe_Live chat_fpw-view' located by 'By.xpath: id("ext-gen44")/body[1]/iframe[@class="fpw-view"]' not found
	at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1097)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword$_switchToFrame_closure1.doCall(SwitchToFrameKeyword.groovy:77)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword$_switchToFrame_closure1.call(SwitchToFrameKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.switchToFrame(SwitchToFrameKeyword.groovy:84)
	at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.execute(SwitchToFrameKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.switchToFrame(WebUiBuiltInKeywords.groovy:2850)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$switchToFrame$0.call(Unknown Source)
	at Script1569259338681.run(Script1569259338681.groovy:19)
	... 11 more
)

hi all please help with this issue I’m having. under firefox browser i’m running the following script. in my last step when click, its supposed to close pop up. In chrome this works just fine.

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

WebUI.openBrowser('staging2-web.partycity.com/')

WebUI.switchToFrame(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/iframe_concat(id(  ext-gen45  )body1iframeclass  fpw-view  )_fpw-view 2'), 
    10, FailureHandling.STOP_ON_FAILURE)

WebUI.waitForElementVisible(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/div_ILL PAY FULL PRICE'), 
    10, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject('Page_Online Party Store with over 850 Store Locations  Party City/div_ILL PAY FULL PRICE'), 
    FailureHandling.STOP_ON_FAILURE)

Hi @j_berg72

The error is saying that it cannot verify the image present. Please open Firefox browser, navigate to that page and use Inspection Tool to see if the image’s locator actually identifies an object.

Note: I took the initiative and edited your question. Next please separate your question from code, console log. A lack of distinction demotivates answers.

Cheers !

So what if the xpath in Firefox is different than the xpath in chrome for that same element. How to set up the selector for that?

That should NEVER be the case. Any webpage constructing web elements differently based on user agent differences is a poorly designed web page.

Post the HTML for both Firefox and Chrome.

As @Russ_Thomas said, if the xpath is different between Firefox and Chrome then it’s a sign of poorly designed web page. That said, if you know beforehand what locator works on what browser, then upon hitting a test object that’s dependent on the type of browser, you can:

String browserType = DriverFactory.getExecutedBrowser().toString();
if( browserType == 'Firefox') {
// do action on TestObject A which contains the correct locator for firefox
} else if(browserType == 'Chrome') {
// do action on TestObject B which contains the correct locator for chrome
}

But, you need to really think if this is the only object that depends on the type of browser. If the web developer did it this way, then what stopped him from designing other objects the same way ?

2 Likes

send a bug report to the webpage developer. easy as that!

don’t take it wrong. it’s a common issue those days. the idea behind is ‘boss, we cannot automate tests for an inconsistent product’. so, you just found a design issue, send it to upstream and let them handle it
unless … you are also the developer of the AUT. i hope is not the case, will be the worst scenario …

LE: or you can argue 'boss, such inconsistent behavior require additional effort for the test team. so, let’s talk about money… '. be smart, don’t keep the pressure on yourself …

@j_berg72 Of course, we’re of the opinion that you’re mistaken about the xpath differences.

If you post your HTML, like I said, we can help you further. Better still, if it’s a public URL, post that.

hi russ, the url is https://www.partycity.com/
when the home page loads this pop up is displayed. my goal is to close the pop up by clicking the i’ll pay full price button. it seems to fail on firefox because the xpath is:
id(“ext-gen45”)/body[1]/iframe[@class=“fpw-view”]

chrome the xpath is id(“ext-gen44”)/body[1]/iframe[@class=“fpw-view”]

  1. The popup never appears for me in Firefox.

  2. In Chrome, the popup is inside an iframe - your selector needs to allow for that

  3. Also in chrome, the console is showing these errors which you should report to the developers:

or use an ad-blocker :smiley: but pay attention to the fake ones

1 Like