简体   繁体   English

如何用Java解决硒中的类名的一部分是否动态?

[英]how to solve if a part of classname is dynamic in selenium with java?

(before refresh the page the image is having classname as shown as) (在刷新页面之前,图像具有类名,如下所示)

<div class="icon-image SL_AND_ROLL"></div>

after some event if we refresh the webpage the image classname is as(for dynamic image) 在某些事件之后,如果我们刷新网页,则图像类名为(对于动态图像)

<div class="icon-image CLOSED"></div>

there is no change in xpath before and after event and refresh the page 事件前后的xpath没有变化,并刷新页面

您还可以通过部分类名称来跟踪元素,例如

By.cssSelector(".icon-image")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java中的Selenium无法识别类名 - Selenium in java unable to identify classname 如何通过类名识别元素并使用Selenium和Java单击它? - How to identify an element through classname and click on it using Selenium and Java? 如何解决java.lang.NoClassDefFoundError? 硒 - How to solve java.lang.NoClassDefFoundError? Selenium 如何解决测试中的Java硒错误? - How to Solve Java selenium error in testing? Java中的Selenium WebDriver。 通过标签ClassName和父ClassName选择 - Selenium WebDriver in Java. Select by tag ClassName and parent ClassName 无法在 Selenium 和 Java 中使用 className 定位元素 - Unable to locate element using className in Selenium and Java Selenium Webdriver(Java)-将类名值保存到变量中 - Selenium Webdriver (Java) - save classname value into the variable 如何获取URL Selenium Webdriver的最后一部分(动态ID) - how to obtain last part(dynamic id)of the url selenium webdriver 我如何从 dropdownmenu 中获取 Id、className 或 CSS Selector,它是 java 中 selenium 的 div - How do I get Id, className, or CSS Selector from dropdownmenu that is div for selenium in java 如何通过Selenium和Java查找以特定文本开头和以特定文本结尾的类名 - How to find classname starting with a particular text and ending with a particular text through Selenium and Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM