Как запустить Selenium Server с определенным профилем Firefox в скрипте C#

Мне нужно запустить Firefox с определенным профилем на сервере Selenium. Оригинал моей проблемы: моему веб-сайту, который я протестировал, нужен собственный сертификат корневого центра сертификации. Потому что у Selenium нет встроенных функций для этого, я создал определенный профиль, определил сертификат и ii планирую установить этот профиль по умолчанию на сервере селена. я пробовал разные способы, но не работал: 1. я передал параметры серверу Selenium:

java -Dwebdriver.firefox.profile = SeleniumTest -jar selenium-server-standalone-3.7.1.jar

мой код:

DesiredCapabilities caps = new DesiredCapabilities();
Driver = new RemoteWebDriver(new Uri("http://192.168.31.69:4444/wd/hub"), caps);
  1. я использовал функцию FirefoxProfile в моем коде:

    FirefoxProfileManager profileManager = new FirefoxProfileManager();
    FirefoxProfile profile = profileManager.GetProfile("SeleniumTest");
    Driver = new RemoteWebDriver(new Uri("http://192.168.31.69:4444/wd/hub"), caps.toCapabilities());
    
  2. Функция FirefoxOptions:

    FirefoxProfileManager profileManager = new FirefoxProfileManager();
    FirefoxProfile profile = profileManager.GetProfile("SeleniumTest");
    FirefoxOptions ffopt = new FirefoxOptions();
    ffopt.SetPreference(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
    
  3. я использовал функцию DesiredCapabilities:

    FirefoxProfileManager profileManager = new FirefoxProfileManager();
    FirefoxProfile profile = profileManager.GetProfile("SeleniumTest");
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
    

Никто из них не работал так, как я ожидал, они начали с нового профиля, а не моего определенного профиля.

Мой сценарий написан на C#.
Селен версия 3.7
Версия сервера Selenium: selenium-server-standalone-3.7.1.jar

0 ответов

Другие вопросы по тегам