如何滚动到元素以避免出现此类错误,我使用技巧
browser.action.send_keys(:page_down)
.perform
它找到了元素,有没有其他方法可以滚动到视图中?
我尝试了location_once_scrolled_into_view
,但无法了解其工作原理。
答案 0 :(得分:0)
您可以通过execute_script()
滚动查看元素:
driver.execute_script("arguments[0].scrollIntoView();", element)