以下是我的代码:
case BrowserType.PhantomJS:
var service = PhantomJSDriverService.CreateDefaultService(Path.Combine(_rootPath, @"Packages\"));
var cookieFilePath=Path.Combine(_rootPath, @"Packages\cookie.txt");
if (!File.Exists(cookieFilePath))
File.Create(cookieFilePath);
var phantomjsoptions = new PhantomJSOptions();
driver = new PhantomJSDriver(service,phantomjsoptions);
var cookieJar = driver.Manage().Cookies;
driver.Navigate().GoToUrl(SeleniumConfiguration.Current.BaseURL);
cookieJar.AddCookie(new Cookie("x", "12345"));
return driver;
Run Code Online (Sandbox Code Playgroud)
基本上问题是我无法登录我的测试应用程序因为我收到错误说 -
"您的浏览器设置为阻止Cookie"
我已经尝试了一切,但我似乎无法得到解决方案.
我该怎么办?
请帮帮我.
如果遗漏了一些细节,请告诉我.