私は Selenium を使用しており、javascript を実行するための次の拡張メソッドがあります。
    private const int s_PageWaitSeconds = 30;
    public static IWebElement FindElementByJs(this IWebDriver driver, string jsCommand)
    {
        return (IWebElement)((IJavaScriptExecutor)driver).ExecuteScript(jsCommand);
    }
    public static IWebElement FindElementByJsWithWait(this IWebDriver driver, string jsCommand, int timeoutInSeconds)
    {
        if (timeoutInSeconds > 0)
        {
            var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
            wait.Until(d => d.FindElementByJs(jsCommand));
        }
        return driver.FindElementByJs(jsCommand);
    }
    public static IWebElement FindElementByJsWithWait(this IWebDriver driver, string jsCommand)
    {
        return FindElementByJsWithWait(driver, jsCommand, s_PageWaitSeconds);
    } 
私の HomePage クラスには、次の属性があります。
public class HomePage : SurveyPage
{
    [FindsBy(How = How.Id, Using = "radio2")]
    private IWebElement employerSelect; 
    public HomePage(IWebDriver driver) : base(driver)
    {
    }
    public override SurveyPage FillOutThisPage()
    {
        employerSelect.Click();
        employerSelect.Submit();
        m_driver.FindElement(By.)
        return new Level10Page(m_driver); 
    }
}
ただし、employerSelectはJavascriptによって生成されるため、次のような方法はありますか:
public class HomePage : SurveyPage
{
    const string getEmployerJsCommand= "return $(\"li:contains('Employer')\")[0];";
    [FindsBy(How = How.FindElementByJsWithWait, Using = "getEmployerJsCommand")]
    private IWebElement employerSelect; 
    public HomePage(IWebDriver driver) : base(driver)
    {
    }
    public override SurveyPage FillOutThisPage()
    {
        employerSelect.Click();
        employerSelect.Submit();
        m_driver.FindElement(By.)
        return new Level10Page(m_driver); 
    }
}
本質的に、次のような FindsBy 属性の一部として生の ExecuteJs 呼び出しを置き換えたいと考えています。
    const string getEmployerJsCommand = "return $(\"li:contains('Employer')\")[0];";
    IWebElement employerSelect = driver.FindElementByJsWithWait(getEmployerJsCommand);
次のような FindsBy 属性の一部に
    const string getEmployerJsCommand= "return $(\"li:contains('Employer')\")[0];";
    [FindsBy(How = How.FindElementByJsWithWait, Using = "getEmployerJsCommand")]
    private IWebElement employerSelect; 
そのようなことをするために何を拡張できますか?