2
페이지가 n 초 이상로드되지 않는지 확인해야합니다.셀렌의 페이지로드 시간 확인
내가 몇 가지 방법 본 적이 셀레늄 및 NUnit과와 C#을 사용
:
1 :
var time1=DateTime.Now.Ticks/TimeSpan.TicksPerMillisecond;
driver.Navigate().GoToUrl("http://football.ua");
var time2=DateTime.Now.Ticks/TimeSpan.TicksPerMillisecond;
Console.WriteLine(time2-time1);
//check difference
2 :
driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10));
driver.Navigate().GoToUrl(---------);
//If the load is greater than 10 seconds, takes exception
//I doubt this method, since exceptions emerge, even if the place is quite large timeout (10 sec)
3 : 명시 대기 사용을
예 :
IWebDriver driver = new FirefoxDriver();
driver.Url = "http://football.ua";
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement myDynamicElement = wait.Until<IWebElement>((d) =>
{
return d.FindElement(By.Id("someDynamicElement"));
});
그러나 나는 URL을 이동하는 대기 고정하는 방법을 모르겠어요. 더 나은 점이나 나만의 버전을 알려주십시오.
페이지가로드되는 방식은 어떻게 정의합니까? By.Id ("someDynamicElement")'가 존재합니까? –
Firefox 브라우저를 사용하는 경우 유용 할 수 있습니다. - https://groups.google.com/forum/#!searchin/firebug/persist/firebug/m-3liXcd_T4/d-qlcGUHaKIJ – praneel