python - Double Click On A WebElement in an iframe nested in an other iframe -


basically, page has following spec:

<html>    ...    <iframe id="lvl1">        <html>            <iframe id="lvl2">                <div>double click me !</div>            </iframe>        </html>    <iframe> </html> 

i can't manage double click on given element (using actionchain) because when movetargetoutofboundsexception thrown.

    selenium.webdriver.common.action_chains import actionchains     selenium.common.exceptions import movetargetoutofboundsexception      try:         action = actionchains(context.browser)         action.double_click(webelement)         action.perform()     except movetargetoutofboundsexception:         context.browser.switch_to_default_content()         context.browser.switch_to_frame("lvl1")         context.browser.switch_to_frame("lvl2")         actions = actionchains(context.browser)         my_locationxy = emoji.get_location()         actions.move_to_element_with_offset(frame, my_locationxy["x"], my_locationxy["y"]).double_click().perform() 

i based previous snippet on last comment posted here.

the method posted in above link 1 in fact. issue current selected frame not n-1 th frame , needed explicit reference n-th frame (the 1 element is)

location = (element.location['x'] + element.size['width'] / 2, element.location['y'] + element.size['height'] / 2)  #switching n-1 th frame, frames array of frames' name frames = page.frame  browser.switch_to_default_content() framename in frames[:len(frames) - 1]:     browser.switch_to_frame(framename)  #handle n th frame frame = browser.find_element_by_tag_name(name="iframe") action = actionchains(context.browser) action.move_to_element_with_offset(frame, location[0], location[1]).double_click() action.perform() 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -