小编Cha*_*yar的帖子

Selenium Error - 对远程WebDriver的HTTP请求在60秒后超时

我已经使用Selenium好几个月,我们用它来自动化我们的一些内部测试过程.脚本一直很好.我最近使用FF 27.01升级到C#2.40.0 webdriver,我们的脚本现在在随机位置失败,出现以下错误.

[Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed out after 60 seconds.
  ----> System.Net.WebException : The operation has timed out
TearDown : OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/window timed out after 60 seconds.
  ----> System.Net.WebException : The operation has timed out
[09:01:20]
[Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed …
Run Code Online (Sandbox Code Playgroud)

c# teamcity selenium nunit selenium-webdriver

72
推荐指数
8
解决办法
8万
查看次数

spyOn无法找到一个窥探start()的对象

我正在使用angular-cli测试框架.

在我的组件中,我使用了'ng2-slim-loading-bar'节点模块.

submit(){
    this._slimLoadingBarService.start(() => {
    });
    //method operations
}
Run Code Online (Sandbox Code Playgroud)

现在当我测试这个组件时,我已经将spyOn这个服务应用于:

beforeEach(() => {
    let slimLoadingBarService=new SlimLoadingBarService();
    demoComponent = new DemoComponent(slimLoadingBarService);
    TestBed.configureTestingModule({
        declarations: [
            DemoComponent
        ],
        providers: [
            { provide: SlimLoadingBarService, useClass: SlimLoadingBarService}
        ],
        imports: [
            SharedModule
        ]
    });
});
it('should pass data to servie', () => {
    spyOn(slimLoadingBarService,'start').and.callThrough();
   //testing code,if I remove the above service from my component, test runs fine
});
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

它抛出以下错误:

spyOn无法找到一个窥探start()的对象

javascript jasmine typescript angular2-testing angular

8
推荐指数
2
解决办法
2万
查看次数

国家气象局 API 内部服务器错误

尝试使用他们的新 API 获取数据时,我不断收到错误 500,即使我包含他们请求的 UserAgent 字符串:https : //forecast-v3.weather.gov/documentation

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.weather.gov/points/40,-90/forecast/hourly");

request.UserAgent = "WeatherTest/v1.0 (http://www.website.com/; Email@email.com)";

// exception occurs here
using (Stream stream = request.GetResponse().GetResponseStream())
{
    using (StreamReader streamReader = new StreamReader(stream))
    {
        var jsonData = streamReader.ReadToEnd();
    }
}
Run Code Online (Sandbox Code Playgroud)

但我可以使用相同的网址在浏览器上使用端点:https : //api.weather.gov/points/40,-90/forecast/hourly

我还用另一个 API(Weather Underground)测试了这段代码,它可以工作,但我的老板希望我改用 National Weather Service api。任何帮助表示赞赏!

c# weather-api

2
推荐指数
1
解决办法
1168
查看次数