[英]How to highlight webelement in selenium webdriver not using javascriptExecutor
I want to highlight web element using selenium web driver but i don't want to use JavaScript Executor for the same. 我想使用Selenium Web驱动程序突出显示Web元素,但我不想使用JavaScript Executor。 if i am using java script executor my DOM is getting change.
如果我使用的是Java脚本执行程序,则我的DOM会发生更改。 that is the reason i don't want to use it.
这就是我不想使用它的原因。 is there any alternate way to highlight web element?
有没有其他方法可以突出显示Web元素? please suggest me a way to do this.
请给我建议一种方法。 Thanks in advance
提前致谢
Please try this, I don't know whether this will change your DOM and framework. 请尝试一下,我不知道这是否会更改您的DOM和框架。
`JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].style.color='red'", webElement);
Thread.sleep(5000);
js.executeScript("arguments[0].style.color='grey'", webElement);`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.