重新初始化远程 Webdriver

Re-Initialize Remote Webdriver

所以我一直在尝试通过在静态 webdriver 扩展中调用它来重新实例化我的远程 webdriver class

public static void WaitForForm(this RemoteWebDriver rwd, string form)
{
    rwd = new IOSDriver<IOSElement>(new Uri("http://127.0.0.1:4723/"), 
    appCapabilities);
    rwd.WaitUntil(drv => rwd.Title == form);
}

我收到以下错误消息:

An unknown error occurred in the remote end while processing the command.

事实证明,每次重新实例化驱动程序时都需要设置 DesiredCapabilities。就我而言:

appCapabilities.SetCapability("app", pathToApp);