java - Using Selenium webdriver when tried to get the CSS property of background-color, it returned ‘transparent’ -
When using the Selenium WebDriver in Java, when I try to get the background color, the result is obtained as a hex value rather than transparent. I
if (elementName.contains (" background ")) getColor = driver.find element (byexpath). GetCssValue ("background-color"); String [] numbers = getColor.replace ("RGBA (", "") .replace (")", "") .split (","); Int r = integer.centrate (number [0] .tem ()); Int g = integer. Parcel (number [1] .tim ()); Int b = integer Parasont (number [2] .tem ()); Hex = "#" + integer.txtster (r) + integer.txtstring (g) + integer.txtestring (b); String [] numbers = getColor.replace ("RGBA (", "") .replace (")", "") .split (",");
returns the above code as "transparent"
Try the following code:
((JavaScript Execution driver)). ExecuteScript ("return logic [0] .style.background-color", element);
Comments
Post a Comment