Katalon scripts is not working in iframe

Hi,

I am doing test with e-commerce site. At last, there is a finish purchase page. Here I have to enter the delivery address and details. But this is in iframe. When I run the katalon script, it’s properly switched to iframe but after that couldn’t pass any values in the finish purchase fields neither couldn’t find those field elements.

Below is the test result after execution;
image

Can anyone help why I couldn’t pass any values in those fields?

Is there any way you can share the HTML for the element, including the parent iframe? Is it possible that the element defined by “Object Repository/Finish Purchase/Enter email 1” is further nested in another iframe within the current one?

Hi,

This is the parent iframe,


This is the element for the field,

There is no nested iframe in between the above mentioned iframe and the element (for the field).

This seems to be like compatibility issue between chrome browser and the driver.

I had the same problem, updating the Chromedriver worked for me:

You will need to replace the one found in your KatalonFolder (Katalon_Studio_Windows_64-5.Version\configuration\resources\drivers\chromedriver_win32) with the downloaded one this should fix the issue.

Hi,

Just for clarification, Is there any links between iframe and chrome driver? Because my scripts other than iframes are working!

Yes, regardless of which driver you are using (chromedriver, geckodriver, etc.), there are methods to switch to the appropriate frame. Katalon simply wraps this into the WebUI.switchToFrame() method. According to your log viewer screenshot though, it looks like that is already happening:

image

Can you post the error you are getting with the sendKeys() call? I’m guessing you’re getting a WebElementNotFoundException, but not sure. Also, can you share the locator that is used in the ‘Object Repository/Finish Purchase/Enter email 1’ object? (XPath, CSS, attributes, whichever). If it is an XPath, the best path (after switching to the appropriate frame) should be something like:

//input[@id='email']

Hi,

I have tried with the xpath;
image

Below is the error I am getting.

Everything looks OK to me. The only thing that I can see could be holding you back at this point is that the XPath is getting executed in the wrong frame. Try running the xpath in the browser’s inspector like so:

1.) Make sure your inspector is in the appropriate frame with this selection (chrome):

image

2.) Execute the xpath like this:

$x("//input[@id='email']")

If this spot check passes, I would re-investigate the switchToFrame() line of code to ensure that you are in the right context.

Hi,

I have verified the iframe selection as you said in step 1 from your previous reply. It seems the same frame I have used.

Below is my switch to frame object and test case;


image