I have 2 classes: - BasePageElement(parent) and Action(child of BasePageElement).
I have 2 methods:
public void Click(Expression<Func<TP, Action>> action)
{
WaitSomething(action);
some code
}
public void WaitSomething(Expression<Func<TP, BasePageElement>> action)
{
}
So I have the problem in click method because Cannot convert type Expression< Func< TP,Action>> to Expression< Func< TP,BasePageElement>>
How can I solve it?
Your problem is that you try to convert a child class (Action) to a parent class (BasePageElement). And that is not possible. Only the other way round is possible.
Thus you would have to convert manually Expression<Func<TP, Action>>
into Expression<Func<TP, BasePageElement>>
and then call WaitForSomething with the converted value as parameter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.