我尝试单击页面中未出现的元素,然后使用“将关键字滚动到视图中”关键字,但它没有滚动到视图中,并且机器人返回元素此时不可单击。
I try these way: Nothing happen and cannot click
Scroll Element Into View &{quickLink}[sendDoc]
Set Focus To Element ${PRODUCT}
Click Element ${PRODUCT}
And these way: it scroll to the bottom of page and cannot click
Wait Until Element Is Visible ${PRODUCT} timeout=30s
${x}= Get Horizontal Position ${PRODUCT}
${y}= Get Vertical Position ${PRODUCT}
Execute Javascript window.scrollTo(${x}, ${y})
Set Focus To Element ${PRODUCT}
Click Element ${PRODUCT}
ElementClickInterceptedException:消息:元素在点(453.75,186.5)不可点击,因为另一个元素将其遮盖了
答案 0 :(得分:1)
除了滚动之外,您还有更多选择:
1)调整浏览器的大小,因此无需滚动(使用xvfb创建具有特定大小的屏幕,然后使用“设置窗口大小”)
2)我猜仅使用“等待元素可见”就足够了。无需滚动