location = (element.location['x'] + element.size['width'] / 2, element.location['y'] + element.size['height'] / 2)
#Switching to the n-1 th frame, frames is an array of frames' name
frames = page.frame
browser.switch_to_default_content()
for frameName in frames[:len(frames) - 1]:
browser.switch_to_frame(frameName)
#Handle to the 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()
在上面的链接中发布的方法实际上是一个很好的方法。我当前选择的帧不是第n-1帧,我需要显式引用第n帧(我的元素所在的帧)
相关问题 更多 >
编程相关推荐