Unable to switch to google sign in pop up iframe

I am trying to switch to the Google pay sign in window using the switchToFrame method. I am using the following xpath:


I am using the command:

WebUI.switchToFrame(findTestObject('AccountManagement/test'), 5)

and then I am trying to input login details.

Also, the email address input field exists inside the first div after the body tag and not within iframe

I am getting following error when I run my test:

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/AccountManagement/test' located by '//*[@id="yDmH0d"]/iframe[1]' not found

Does someone knows a way on how I can switch to this sign in popup.

@farooqi.uzair1990, try the following: How to (manually) work with iframes in Katalon

Hi @farooqi.uzair1990,

Not sure if I can simulate your situation 100% the same but I think that below solution will be work.

  1. I try to simulate your situation with below HTML as an example:

There is one textbox which is displayed under iframe, see below image

  1. Now, we want to interact with text box, for this case I use to settext for this object

  2. Solution:

A: Using keyword provided by Katalon switchToFrame, your side does not work well with this solution
B. I try the work around by capturing object under the iframe and seeing it work

B1. Identify object textbox

B2.Identify iframe

Now, you are able to using keyword settext to enter text directly to your text box

Solution A & B, Katalon users will try with them

C. For solution C, selenium users will try as below

C1. Get web driver from Katalon
C2: Identify iframe object
C3: Switch to this iframe
C4: identify the inner iframe object (this case is text box
C5: settext for object in step C4

Below is example:

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver

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

WebDriver driver = DriverFactory.getWebDriver()

iframe = driver.findElement(By.xpath(“//iframe[@id=‘a077aa5e’]”))
myTextBox = driver.findElement(By.xpath(“//input[@length=‘20’]”))

After executing: it run successfully with text entered as below screenshot

Hope it is useful.


Note: For your case, from your site, need to check switch to windows, window index to make sure driver navigate to new gmail tab/windows before doing next actions

Hi. I see that your solution is based on the fact that the text box exists within the iframe. In my case, the input field exists inside a div field that is a separate tag from the iframe