-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
을 정의해야합니까?