client.frame(1) is inconsistent in the same scenario. why?

11 views
Skip to first unread message

Ghisoi Ioan

unread,
May 28, 2017, 6:39:34 AM5/28/17
to webdriver

I am doing browser.frame(1) to switch the context to the only iframe that I have on the page.

My problems is that I saw that this context switch is inconsistent by running the same scenario 10 times.

There are random moments when this fails, and whatever I want to do in that iframe (like setting a value) fails, telling me that the element is in an invalid state.

This is what I do ( the pause is just for me to make sure time is not a problem )

browser.waitForVisible('iframe[id="cko-iframe-id"]', 5000) //is visible
browser.pause(1000)
browser.frame(1)
browser.pause(1000)
browser.setValue(x,y)

Also, I tried to do this but I always get ("Element is not currently interactable and may not be manipulated"):

browser.waitForVisible('iframe[id="myFrame"]',5000);
var my_frame = browser.$('iframe[id="myFrame"]').value;
browser.frame(my_frame);
browser.setValue(x,y)

What is the correct and reliable way to switch context to myFrame? Or what am I doing wrong?

Reply all
Reply to author
Forward
0 new messages