Selenium 오류-원격 WebDriver에 대한 HTTP 요청이 60 초 후에 시간 초과되었습니다.
저는 몇 달 동안 Selenium을 사용해 왔으며 내부 테스트 프로세스 중 일부를 자동화하는 데 사용하고 있습니다. 스크립트가 잘 전달되었습니다. 최근 FF 27.01을 사용하여 C # 2.40.0 웹 드라이버로 업그레이드했으며 이제 스크립트가 다음 오류와 함께 임의의 위치에서 실패합니다.
[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 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
at OpenQA.Selenium.Support.UI.DefaultWait`1.PropagateExceptionIfNotIgnored(Exception e)
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at Portal.Test.Helpers.Process_Bookings.OpenBookings.SelectBooking(String bookingnumber)
at Portal.SmokeTest.SmokeRunTest.Booking() in d:\TeamCityAgent\work\dac1dcea7f2e80df\SmokeTests\SmokeRunTest.cs:line 68
--WebException
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
--TearDown
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.Close()
at Portal.Test.Helpers.Setup.CloseWebdriver()
at Portal.SmokeTest.SmokeRunTest.TearDown() in d:\TeamCityAgent\work\dac1dcea7f2e80df\SmokeTests\SmokeRunTest.cs:line 162
--WebException
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
한 줄의 코드로 추적 할 수 있었던 최신 오류 :
_setup.driver.FindElement(By.XPath("//button[@class='buttonSmall lockBookingButton']")).Click();
성가신 것은 문제를 해결하려는 시도가 마치 로컬 컴퓨터에서 테스트를 실행하는 것처럼 디버그에서 통과하는 것처럼 어렵다는 것입니다. 또한 테스트를 실행중인 빌드 머신에서 NUNIT 실행기를 통해 실행하면 통과합니다. Teamcity를 사용할 때 자동화 된 빌드 실행 프로세스의 일부로 만 실패하는 것 같습니다. 내가 말했듯이, 이것은 이전에 몇 달 동안 잘 돌아가고 있었고 변경된 유일한 것은 셀레늄 웹 드라이버 키트입니다.
나는 디버그 중에이 문제를 경험했으며, Click()
코드 줄이 호출 되었을 때 Firefox가 잠긴 것처럼 보였고 테스트를 중지해야만 Firefox를 계속할 수 있습니다. webdriver 소스 수정을 포함하여 여기에 많은 제안이 있습니까? 다른 사람이 제안을 할 수 있다면 가능한 한 그 길을 가고 싶지 않습니다.
new FirefoxDriver(new FirefoxBinary(),new FirefoxProfile(),TimeSpan.FromSeconds(180));
위의 코드 줄을 사용하여 브라우저를 시작합니다. 그것은 나를 위해 일했습니다.
Chrome 드라이버 (v2.23)를 사용하거나 TeamCity를 통해 테스트를 실행하면 비슷한 문제가 발생했습니다. Chrome 옵션에 "샌드 박스 없음"플래그를 추가하여 문제를 해결할 수있었습니다.
var options = new ChromeOptions();
options.AddArgument("no-sandbox");
FF 드라이버에 비슷한 옵션이 있는지 잘 모르겠습니다. 내가 이해하는 바에서 문제는 SYSTEM 계정으로 Selenium을 실행하는 TeamCity와 관련이 있습니다.
나는 몇 달 전에 (또한 click()
명령에서) 이 문제를 처음 접했으며 그 이후로 나에게 문제가되었습니다. .NET Selenium 바인딩에 문제가있는 것 같습니다. IE 드라이버에서 일하는 사람이 작성한이 블로그 게시물은 무슨 일이 일어나고 있는지 설명하는 데 도움이됩니다.
http://jimevansmusic.blogspot.com/2012/11/net-bindings-whaddaymean-no-response.html
불행히도이 문제에 대한 실질적인 해결책은없는 것 같습니다. 이 문제가 Selenium 개발자에게 제기 될 때마다 ( 여기 참조 ), 이것은 일반적인 응답입니다 .
재현 가능한 시나리오가 필요합니다. 여기에는 샘플 페이지 또는 문제를 재현 할 수있는 공개 사이트 페이지에 대한 링크가 포함되어야합니다.
일관되게 재현 가능한 테스트 케이스를 제출할 수 있다면이 버그를 영구적으로 유지하는 데 매우 도움이 될 수 있습니다.
즉, 그 동안이 해결 방법을 시도해 볼 수 있습니다. 시도하려는 HTML 버튼에 Javascript가 포함 click()
된 onclick
속성이있는 경우 명령을 호출하는 대신 JavascriptExecutor 를 사용하여 해당 코드를 직접 실행하는 것이 좋습니다 click()
. onclick
Javascript 를 실행 하면 일부 테스트를 통과 할 수 있음을 발견했습니다 .
제 경우에는 버튼의 유형이 submit
아니고 모든 작업이 잘 되도록 button
변경합니다 . 아래와 같이Click
Sumbit
...에서 driver.FindElement(By.Id("btnLogin")).Click();
...에 driver.FindElement(By.Id("btnLogin")).Submit();
BTW, 나는이 게시물의 모든 대답을 시도했지만 나를 위해 일하지 않았습니다.
비슷한 문제가 있습니다. 드라이버의 생성자에 더 많은 시간을 설정하십시오.
var timespan = TimeSpan.FromMinutes(3);
var driver = new FirefoxDriver(binary, profile, timeSpan);
이 문제는 웹 드라이버 개체에 액세스하려고 할 때 발생한다고 생각합니다.
1) a window has closed and you haven't yet switched to the parent
2) you switched to a window that wasn't quite ready and has been updated since you switched
waiting for the windowhandles.count
to be what you're expecting doesn't take into account the page content nor does document.ready. I'm still searching for a solution to this problem
In my case, it's because I deleted the chrome update folder. After chrome reinstall, it's working fine.
The problem is that the evaluation of Click()
times out on your build env.. you might want to dig into what happens on Click()
.
Also, try adding Retrys for the Click()
because occssionally the evaluations take longer time depending on network speeds, etc
In my case I found this error happening in our teams build server. The tests worked on our local dev machines.
The problem was that the target website was not configured correctly on the build server, so it couldn't open the browser correctly.
We were using the chrome driver but I'm not sure that makes a difference.
changing the Selenium.WebDriver.ChromeDriver from 2.40.0 to 2.27.0 is ok for me
In my case the issue was with SendKeys() and Remote Desktop. Posting the workaround I have so far:
I had a Selenium test which would fail when run as part of a Jenkins job on a node hosted in vSphere and administered through RDP. After some troubleshooting it turned out it succeeds if Remote Desktop is connected and focused but fails with the exception if Remote Desktop is disconnected or even minimized.
As a workaround, I logged through vSphere Console instead of RDP and then even after closing vSphere the test didn't fail anymore. This is a workaround but I would have to be careful never to login through RDP and always to administer only through vSphere Console.
The new FirefoxDriver(binary, profile, timeSpan)
has been obsolete.
You can now use new FirefoxDriver(FirefoxDriverService.CreateDefaultService(), FirefoxOptions options, TimeSpan commandTimeout)
instead.
There is also a new FirefoxDriver(string geckoDriverDirectory, FirefoxOptions options, TimeSpan commandTimeout)
and it does works. But it's undocumented, and you need to manually specify geckoDriverDirectory
even though it's already in Path
.
We had the same problem. In our case, the browser was blocked by a login popup (Windows authentication), so not returning after 60 seconds. Adding correct access rights to the Windows account Chrome was running under solved the problem.
For ChromDriver the below worked for me:
string chromeDriverDirectory = "C:\\temp\\2.37";
var options = new ChromeOptions();
options.AddArgument("-no-sandbox");
driver = new ChromeDriver(chromeDriverDirectory, options,
TimeSpan.FromMinutes(2));
Selenium version 3.11, ChromeDriver 2.37
'Program Tip' 카테고리의 다른 글
GetStringUTFChars가 복사본을 반환하면 ReleaseStringUTFChars를 호출해야합니까? (0) | 2020.11.02 |
---|---|
Python 스크립트에서 사용할 암호를 안전하게 저장 (0) | 2020.11.02 |
Selenium은 헤드리스 브라우저 테스트를 지원합니까? (0) | 2020.11.02 |
jsFiddle로 두 개 이상의 프레임 워크를 선택하려면 어떻게해야합니까? (0) | 2020.11.02 |
SVG에서 텍스트 정렬 (0) | 2020.11.02 |