does not let you pick the current style of an element unless it is specified in style attribute of that element. However you can use JavaScript to pick any evaluated style of the element and pass it to your script.

Below is the example for Java:

    driver.get("https://www.w3schools.com");
    WebElement el = driver.findElement(By.xpath("//a[text()='LEARN HTML']"));
    String contents = (String) ((JavascriptExecutor) driver)
            .executeScript("return window.getComputedStyle(arguments[0]).getPropertyValue('background-color');", el);
    System.out.println(contents);
    driver.close();



Source link https://sqa.stackexchange.com/questions/35197/what-should-be-the--to---using-selenium

LEAVE A REPLY

Please enter your comment!
Please enter your name here