1 回答

TA貢獻1810條經驗 獲得超4個贊
最后我通過使用修復:
public T InstantiatePage<T>() where T : class
{
// COUNTRY code as defined in
// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
var className = string.Format("{0}_{1}", typeof(T).FullName, getCulture());
// T will be base class if no derived class with COUNTRY code suffix is found
var classType = Type.GetType(className) ?? typeof(T);
// Instantiate the page
var instance = Activator.CreateInstance(classType, new object[] { WebDriver });
return (T)instance;
}
我很確定使用 PageObject.PageFactory 可以改善它
- 1 回答
- 0 關注
- 130 瀏覽
添加回答
舉報