Issues locating all elements inside a modal(Firefox)

Hello any help is appreciated. I recently wrote a script to fill out a form(modal). My test runs seamlessly in Chrome. However, with Firefox it cannot find any of these elements. I have tried suggestions on the forum: Focus on modal, changing the CSS value, I even re-captured the object using Web Object Spy with Firefox. I did notice that if I use the clickElement(to) keyword from default examples, then it works correctly. All it does is convert the TestObject back to a WebElement and clicks it. Does Firefox have issues handling TestObjects? I supplied a dummied-down version of a TC with both clicks on the same element. Block under // Click by WebElement works, Click by TestObject does not.

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.util.KeywordUtil
import com.kms.katalon.core.webui.exception.WebElementNotFoundException
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.By
import internal.GlobalVariable as GlobalVariable

String username = findTestData(‘GSSO Users/Login Credentials’).getValue(‘Username’, 2)

String password = findTestData(‘GSSO Users/Login Credentials’).getValue(‘Password’, 2)

WebUI.openBrowser(’’)

‘Navigate to IMS Portal’
WebUI.navigateToUrl(GlobalVariable.portalURLNAV)

WebUI.maximizeWindow()

‘Login into IMS Portal’
CustomKeywords.‘imsPackage.portalKeywords.login’(username, password)

WebUI.switchToFrame(findTestObject(‘iframe_Imaging_clientFrame’), 10)

WebUI.waitForElementVisible(findTestObject(‘IMS Portal/Container_Navigational Pane/Sidebar Elements/button_Study Management’),
60)

‘Navigate to Study Management page’
WebUI.click(findTestObject(‘IMS Portal/Container_Navigational Pane/Sidebar Elements/button_Study Management’))

‘Verify that the Add Study button exist on the Study Management page’
assert WebUI.waitForElementVisible(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/button_Add Study’),
10)

CustomKeywords.‘dynamicPackage.dynamicKeywords.highlightAndCapture’(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/button_Add Study’))

‘Click Add study button’
WebUI.click(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/button_Add Study’))

‘Verify Popup displays when Add Study button clicked’
assert WebUI.waitForElementVisible(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/popup_Add-Edit Study’),
10)

CustomKeywords.‘dynamicPackage.dynamicKeywords.highlightAndCapture’(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/popup_Add-Edit Study’))

/*
// Click by WebElemenrt
try {
WebElement element = WebUI.findWebElement(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/button_Submit’));
KeywordUtil.logInfo(“Clicking element”)
element.click()
KeywordUtil.markPassed(“Element has been clicked”)
} catch (WebElementNotFoundException e) {
KeywordUtil.markFailed(“Element not found”)
} catch (Exception e) {
KeywordUtil.markFailed(“Fail to click on element”)
}
*/

// Click by TestObject
‘Click Submit button’
WebUI.click(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/button_Submit’),
FailureHandling.STOP_ON_FAILURE)

I must add that i pick either or of click by WebElement vs TestObject because it flags an error pop-up that disables the Submit button

Can I see the offending line and it’s error report?

Offending line?:

WebUI.click(findTestObject(‘IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/button_Submit’),
FailureHandling.STOP_ON_FAILURE)

Error:

10-25-2019 08:08:13 AM Test Cases/Portal/Study Management/Regression Testing on Add Study Form

Elapsed time: 48.825s

Test Cases/Portal/Study Management/Regression Testing on Add Study Form FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/IMS Portal/Pages/Page_Study Management/Add-Edit Study Elements/Popup Elements/button_Submit’
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.ClickKeyword.click(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:604)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$8.call(Unknown Source)
at Regression Testing on Add Study Form.run(Regression Testing on Add Study Form:93)
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 TempTestCase1572008891392.run(TempTestCase1572008891392.groovy:23)
Caused by: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: [[CGeckoDriver: firefox on WINDOWS (11a250d7-5da3-432f-b73a-5bcfd73d0f45)] -> xpath: //*[@id = ‘submit’ and (text() = ‘Submit’ or . = ‘Submit’)]] (tried for 30 second(s) with 500 milliseconds interval)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘USLT60007’, ip: ‘10.30.5.146’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.webui.driver.SmartWaitWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 69.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20191001234643, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 12008, moz:profile: C:\Users\lucas.zimmerman\Ap…, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10.0, proxy: Proxy(direct), rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 11a250d7-5da3-432f-b73a-5bcfd73d0f45
at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:56)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more

Try waitForElementVisible on the submit button before you call click. I’m interested to see how/if it changes the error.

Also, show me the definition for the submit button Test Object.

And the HTML for the form containing the button.

I failed to mention that i did do explicit wait on visibility of multiple elements in the modal. It simply cannot see it.

You have this:

But not this:

image

That is because if i look for an iframe within the iframe i definitely will not see the element. For our project we need to be able to test with and without the iframe. it made more sense to switchToFrame() for this instance. I do not have to switch to iframe in my keyword packages

Either way, the real issues is the difference between Chrome and Firefox. Chrome has no flakiness at this point

I understand. And it won’t help you to know, I test in Firefox all day, no issues. But to be ultra-pedantic, I’m guessing when you operate the site as a human, it works whichever browser you choose, right? Which leads me to this point: teaching a robot (your test) to behave like a human is hard. I have no idea what’s going on in that code - it looks fine to me.

That said, I know resorting to JavaScript calls will work in both browsers - that way, you’d be speaking their native tongue :wink:

true, thank you for your help. I was praying their is an issue with the GeckoDriver

is there a way to get the BASIC locator value(xpath) of the known TestObject? I’d like to use that locator to wait on the element

https://docs.katalon.com/javadoc/com/kms/katalon/core/testobject/SelectorCollector.html#getSelectorMethod()

Thank you Russ, I will try this out ASAP