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

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -