divの背景色の値を確認する必要があります。HTMLは次のとおりです。
<div id="outercontainer" align="left">
背景色に関する情報は、ファイル style.css で次のように定義されています。
#outercontainer {
background-color: #EAEAEA;
margin-left: auto;
margin-right: auto;
opacity: 1;
width: 1000px;
z-index: 2;
}
コマンドを使用して bgcolor の値を取得しようとしましたselenium.getattribute
が、セレンは次のエラーメッセージを返しました:
エラー: 要素属性が見つかりませんでした: css=#outercontainer@background-color セッション bc60eb07f15e4e63986634fb59bf58a1
結果として。私のコードのこの部分:
try
{
string atr_str = selenium.GetAttribute("css=#outercontainer@background-color");
Console.WriteLine(atr_str);
}
catch (SeleniumException)
{
Console.WriteLine("Color value was not got.");
}
実際、さまざまなタイプのロケーターでさまざまな方法を試しましたが、何も役に立ちませんでした。何をするようアドバイスできますか?