Problem with IFrame

I have a signup feature. it has 3 steps:

  1. step1: click continue and will redirect to step 2
  2. step2: click continue and will redirect to step 3
  3. step3: click finish and user are registered.

step3 has few iframe where I input text.

if I directly navigate to step 3, then I can successfully carry out my operation in an iframe but the problem is,

if I go to step1 then step2 then step 3, I am getting an error.

Unable to verify image 'Object Repository ...

There is no change in the script but working fine if I directly go to step 3 but giving me an error if I go with the flow from step1, step2, and step3.

Am I missing anything?

Can you post me your full error message?

Vinh Nguyen said:

Can you post me your full error message?

error:

Unable to set text '424242424242' of object 'Object Repository/pageObject_step3/input_cardnumber' (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/pageObject_step3/iframe___privateStripeFrame3' located by 'By.xpath: id("cardNumber-element")/div[@class="__PrivateStripeElement"]/iframe[1][count(. | //iframe[@name = '__privateStripeFrame3']) = count(//iframe[@name = '__privateStripeFrame3'])]' not found)

please note, the same script is working fine if I directly go to the page having an iFrame but I get an error if I navigate from another page.
thanks

@Vinh Nguyen
why this forum is so inactive??

Hi, I hope I understand you correctly. What do you mean with other page? because you did not load the main page (remember iframe is embedded within the main page) then it is not possible to reach the iframe. Are you trying to reach the iframe from another page in which this iframe does not exist. Also the name of the frame can maybe change if you entering it from different embedded pages(’__privateStripeFrame3’) is this 3 unique.

@4037-ralph.van.der.horst@gmail.com
I’ve got 3 pages and the flow is like this
page 1 > page 2 > page 3

page 3 is a page for some payment mechanism and page 3 contains iFrame.
Now, if I go with the flow (page 1, page 2 and page 3), I get an error as mentioned above but if I go directly to page 3 then my script interacts successfully with iFrames.

@kishor sharma / Guys - i am also facing similar issue, did u got any solution?

WebUI.switchToFrame(findTestObject(‘Object Repository/Web_OR/Checkout_Guest/debit_credit_card_numer_iframe’), 60)

WebUI.setText(findTestObject(‘Object Repository/Web_OR/Checkout_Guest/debit_credit_card_number’), ‘4242424242424242’)

Exception:
Test Cases/Helper/New Test Case (1) FAILED because (of) Unable to verify image ‘Object Repository/Web_OR/Checkout_Guest/debit_credit_card_numer_iframe’ present (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Web_OR/Checkout_Guest/debit_credit_card_numer_iframe’ located by ‘By.xpath: //div[@class=‘enterCardInfo’]//div[@class=’__PrivateStripeElement’]/iframe[@name=’__privateStripeFrame16’]’ not found)

Thanks in Advance

Hi guys, did u find the solution of this case? I also faced the same problem about iframe (on another page from the main page).
I really got stuck with this ._.

Hi, guys, there can sometimes be a problem when going from step to step finding an iFrame, the best solution I have found for this would be to add two steps before inputting into the iFrame.

Switch to iFrame

WaitForElementVisible then chose an element that must be loaded in order for you to input on the iFrame.

Let me know how this goes and if there are any more problems I’ll try my best to help.

First thing

how you have added the object in the OR ; is it using web spy or by adding a object using manual mode?

When you spy an object and use it - this issue persist when your flow changes based on the scenario.

Inorder to overcome this:

Observe the iframe in which objects exists in both the cases
1)directly using page3 and then performing your transaction
2)page1>>page2>>page3

Steps to find out iframe in console:
suppose you are using chrome browser
inspect web element >> go to console and observe what value iframe appears in “TOP” in which your web element currently appears based on your scenario

If the iframe value differs in both scenario - then the object you are currently using - will not meet your need.

Create a custom keyword for dynamic object creation and then provide the value based on your scenario.

frameOnConsole.PNG

@Josh Deverson
I’ve tried the step, but even the method Switch to iFrame give me the same error of WebElementNotFoundException.

@6003-Yadav
I used spy object to capture the object. But it looks like didn’t work.
I want to tell you about problem in my case. the problem is I want to click an hyperlink object, so it will open the new window, and I want to get some text from the detail page. The problem shown here. I can only get the object from the detail page for only 1 data. if I use another data, it will give me an error WebElementNotFoundException. I’ve tried to use absolute xpath (I already checked the absolute xpath of both object and it was same), but it still didn’t work to cause of the iframe.

any suggestion?

Hi, I am facing the same issue. When I click on link to add an event, pop up opens on top of inactive parent window. The error message I am getting is ‘Unable to verify image’. In the test application there are multiple iframs and I get the same error message on all. I have tried adding object in manual mode and using web spy as well. Please help and let me know if you need more information from me.

Error message -

Test Cases/New Event FAILED because (of) Unable to
verify image ‘Object
Repository/NewEvent_OR/Page_Calendar/iframe_master_page_master_page’
present (Root cause:
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element
with id: ‘Object
Repository/NewEvent_OR/Page_Calendar/iframe_master_page_master_page’
located by ‘By.xpath:id(“RadWindowWrapper_master_page_master_page_PageContent_Windows1532025666454”)/table[@class=“rwTable”]/tbody[1]/tr[@class=“rwContentRow”]/td[@class=“rwWindowContent rwExternalContent”]/iframe[1]’ not found)

New Event.png

@Manjusha Rajadhyaksha
Hi Manjusha, have u try to set the parent iFrame of the object? or maybe you can use absolute xpath for the iFrame.
In my case, even when I used absolute xpath, it still give me the failure (maybe caused by new window opened, but on your case it was pop up dialog). Hopefully absolute xpath of the iFrame will be work for you

Willis Williandy said:

@Josh Deverson
I’ve tried the step, but even the method Switch to iFrame give me the same error of WebElementNotFoundException.

@6003-Yadav
I used spy object to capture the object. But it looks like didn’t work.
I want to tell you about problem in my case. the problem is I want to click an hyperlink object, so it will open the new window, and I want to get some text from the detail page. The problem shown here. I can only get the object from the detail page for only 1 data. if I use another data, it will give me an error WebElementNotFoundException. I’ve tried to use absolute xpath (I already checked the absolute xpath of both object and it was same), but it still didn’t work to cause of the iframe.

any suggestion?

Can you share >> full error message and a snap shot of manual/script mode to guide you accordingly…

@6003-Yadav
Hi Yadav, here is the error message I’ve got

07-24-2018 04:18:45 PM - [FAILED] - Unable to click on object ‘Object Repository/Cashier Transaction/Payment Receive Allocation/Hyperlink Agreement Card/Page_/span_0.00’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Hyperlink Agreement Card/Page_/iframe_pageForm’ located by ‘By.xpath: //iframe[@src = ‘/CONFINS/LOS/View/ViewAgrmnt/AgrmntCard.aspx?RefId=839&RefCode=’ and @id = ‘pageForm’ and @name = ‘pageForm’]’ not found)

and here is the script that I wrote for my test case


for your reminder, it worked well for only 1 data (for the example, from the script, I used 0080014951 and it worked, but when I change the data 0080014952, it will give me an error above)

*for another information, it will worked to other data only if I tried to start recording from the beginning using that data. but it will be useless if i must do the recording from the beginning for every different data

do you have any idea for this?

ask3.png

Willis Williandy said:

@6003-Yadav
Hi Yadav, here is the error message I’ve got

07-24-2018 04:18:45 PM - [FAILED] - Unable to click on object ‘Object Repository/Cashier Transaction/Payment Receive Allocation/Hyperlink Agreement Card/Page_/span_0.00’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Hyperlink Agreement Card/Page_/iframe_pageForm’ located by ‘By.xpath: //iframe[@src = ‘/CONFINS/LOS/View/ViewAgrmnt/AgrmntCard.aspx?RefId=839&RefCode=’ and @id = ‘pageForm’ and @name = ‘pageForm’]’ not found)

and here is the script that I wrote for my test case


for your reminder, it worked well for only 1 data (for the example, from the script, I used 0080014951 and it worked, but when I change the data 0080014952, it will give me an error above)

*for another information, it will worked to other data only if I tried to start recording from the beginning using that data. but it will be useless if i must do the recording from the beginning for every different data

do you have any idea for this?

when you say you change data to 0080014952 , are using a new object a_0080014952?


and I dont see a step which shows you are switching to iframe and then switching to new window
--------------------------------------------------------------------------------------------------------------------------------
can you create two objects Data1_0080014951,Data2_0080014952 in manual mode by writing xpath for each one of them

once you got your xpath , cross verify whether the objects are displayed in console and then execute your test case.
input >>0080014951 >> click object Data1_0080014951
input >>0080014952 >> click object Data2_0080014952

$x(" xpath of your object")
The below example illustrates your object is found in the webpage

let me know where you reach

verify element present in DOM.PNG

Issue.PNG

@6003-Yadav
oh you’re right. I found what the problem. It caused by the src value from the iFrame object checked (which is including the id of the data). I just unchecked that element and it works well for me.
ahh, thank you so much for helping me, it’s all my bad

really thanks for all of your suggestion :slight_smile:

1 Like

Great! :slight_smile:

1 Like

Hi All

I got same problem and run properly using selenium keyword like this:
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(“YouriFrameId”))