java - Unable tp Switch the context for the third child iframe in the window -
my window has 3 iframes, able switch to, first 2 frames in hierarchy , perform actions, unable switch context third frame.

i able switch fwin0 , content0 frame , set/get values in screen, unable switch context content iframe. tried possible options.
driver.switchto().frame("fwin0"); - works fine driver.switchto().frame("content0"); - works fine driver.switchto().frame("contnet"); - fails, tried integer options
please provide info on why think fails?
meanwhile, try this:
driver.switchto().defaultcontent(); // switch out of frames list<webelement> frames = driver.findelements(by.cssselector("iframe")); // print out frames.size() driver.switchto().frame("fwin0"); driver.switchto().frame("content0"); frames = driver.findelements(by.cssselector("iframe")); // print out frames.size() again // find frame element , switch webelement contentframe = driver.findelement(by.cssselector("#content")); // alternative css locator: by.cssselector("iframe[id='content']") // alternative css locator: by.cssselector("iframe[name='content']") // alternative css locator: by.cssselector("iframe[src*='customsearch']") // alternative xpath locator: by.xpath("//iframe[contains(@src, 'customsearch')]") driver.switchto().frame(contentframe);
Comments
Post a Comment