[英]How to click an element which is not loaded in DOM using selenium java?
There is div with many internal divs as seen in screenshot如屏幕截图所示,有许多内部 div 的 div
As seen in screenshot there are 6col and 1 checkbox col so total 7 columns are visble.如屏幕截图所示,有 6col 和 1 个复选框 col,因此总共 7 列是可见的。 But there are more columns till col40 if you scroll right.但是如果向右滚动,直到 col40 还会有更多列。 But the divs of all 40 cols are not loaded at one time but loads upon scrolling但是所有 40 列的 div 不是一次加载而是在滚动时加载
I want to validate if col35-col40(or any random col after col6) are visible and is editable and clickable.我想验证 col35-col40(或 col6 之后的任何随机 col)是否可见以及是否可编辑和可点击。
I have tried below options but none of them working.我尝试了以下选项,但没有一个工作。
Need some solution for this.需要一些解决方案。
Please note: The scroll bar is not having any identifier/attribute but it is inside the main div without any unique identity.请注意:滚动条没有任何标识符/属性,但它位于主 div 内,没有任何唯一标识。
If your element is not loaded yet in DOM, you cannot perform any actions on it since is not there.如果您的元素尚未在 DOM 中加载,您将无法对其执行任何操作,因为它不存在。 A workaround for your problem is to design a method to scroll until your element is available in DOM, and then perform desired actions (check, click etc).您的问题的解决方法是设计一种滚动方法,直到您的元素在 DOM 中可用,然后执行所需的操作(检查、单击等)。 Note that you cannot scroll to your element (because is not there) so you can scroll to another reference (locator) or based on pixels using javascript executor object.请注意,您无法滚动到您的元素(因为不存在),因此您可以使用 javascript 执行程序对象滚动到另一个参考(定位器)或基于像素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.