-1
動的変数(要素のリスト)を渡してアイテムをループしています。私がアイテムとやり取りしようとしているときに発生するCannot navigate to dynamic member
の問題。FIndParentエラー - 動的メンバーにナビゲートできません
public void definePositions()
{
var positions = PanelPositionsContent.FindElements(By.CssSelector("span[class='cell cell-id-symbol']"));
CheckEntryPrice(positions);
}
private void CheckEntryPrice(dynamic positions)
{
foreach (var position in positions)
{
if (position.Text.ToLower().Equals(ScenarioContext.Current["symbol"].ToString().ToLower()))
{
CommonMethods.Log("Successfully: " + ScenarioContext.Current["symbol"]);
}
if (position.FindParent().FindElement(By.CssSelector("span[class='cell cell-id-price']")).Text.Equals(ScenarioContext.Current["price"]))
{
CommonMethods.Log("Failing test, : " + ScenarioContext.Current["price"] + ", actual price" +
positions[0].FindParent().FindElement(By.CssSelector("span[class='cell cell-id-price']")).Text);
Assert.Fail("Price is not correct");
}
CommonMethods.Log("Passed test, clicked price matches position price: expected price: " + ScenarioContext.Current["price"] + ", actual price: " +
positions[0].FindParent().FindElement(By.CssSelector("span[class='cell cell-id-price']")).Text);
}//calaculate points from curr price to entry
CheckGross();
}
私はdynamic positions
を渡すのではなく、それを定義する必要がありますか?