Selenium highlighted page object

QTP accustomed to using, in QTP can be highlighted by highlight ways to access the object of the direct object, really easy, then how to make the test object Selenium highlighted pages, you can page through javascript modify an object's properties and then highlight object, as follows coding:

    public void highLight(WebElement e) {
            if (driver instanceof JavascriptExecutor) {
                String script="arguments[0].style.border='3px solid red'";
JavascriptExecutor je = (JavascriptExecutor) driver;
            je.executeScript(script,e);
            }
        }

By modifying the corresponding webelement CSS styles in turn allows you to feel the effects of page objects highlighted. The above code will let you specify the objects displayed on the page is highlighted in red.

Reproduced in: https: //www.cnblogs.com/alterhu/p/3357414.html

Guess you like

Origin blog.csdn.net/weixin_34353714/article/details/94029683