I need to verify the value of background color of div. Here's the HTML:
<div id="outercontainer" align="left">
The information about background color is defined in file style.css like so:
#outercontainer {
background-color: #EAEAEA;
margin-left: auto;
margin-right: auto;
opacity: 1;
width: 1000px;
z-index: 2;
}
I tried to get the value of bgcolor using selenium.getattribute
command, but selenium returned me following error message :
ERROR: Could not find element attribute: css=#oute
rcontainer@background-color on session
bc60eb07f15e4e63986634fb59bf58a1
as the result.
This part of my code:
try
{
string atr_str = selenium.GetAttribute("css=#outercontainer@background-color");
Console.WriteLine(atr_str);
}
catch (SeleniumException)
{
Console.WriteLine("Color value was not got.");
}
In fact I tried different ways with different types of locators, but nothing helped me.
What can you advise to do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…