How do you use switchTo() in element.flood.io to interact with 2 iFrames?

387 Views Asked by At

I'm trying to use browser.switchTo().frame(0) method in element.flood.io to switch between iFrames on a page. There are two iframes - xpath locations are //body[1]/form[3]/div[5]/iframe[1] and //body[1]/form[3]/div[2]/iframe[1]

I cant seem to interact with either frame on the page. So far I've tried :

step('3. Switch frame', async browser => {
        await browser.wait.Until.ableToSwitchToFrame()
        await browser.switchTo().frame(0)

I've tried using the xpath too.

step('3. Switch frame', async browser => {
        let iframe = await browser.findElement(By.xpath('//body[1]/form[3]/div[2]/iframe[1]'))
        let newbrowser = await browser.swicthto().frame(iframe)

This link is the which should be helpful but I do not find it to be:

https://element.flood.io/docs/api/browser#switchto

1

There are 1 best solutions below

0
On

You can use:

await browser.wait(Until.ableToSwitchToFrame(frame id))

https://element.flood.io/docs/api/waiters#untilabletoswitchtoframeframe