Java로 Selenium 3.4를 사용하고 있습니다. Chrome에서는 모든 것이 잘 작동합니다. 하지만 파이어 폭스를 사용할 필요가있다.geckodriver에서 "죽은 개체에 액세스 할 수 없습니다"
Dojo UI의 테스트를 자동화하고 Dojo UI가 많은 렌더링을 수행 할 때까지 기다려야한다. 그래서 여기에 내가하는 일이 있으며 Chrome에서 정상적으로 작동합니다. 20 초의 암시 적 대기는 일반적으로 내 코드에서 설정됩니다.
driver.switchTo().defaultContent();
driver.switchTo().frame(driver.findElement(By.id("contentframe"))); // relying on implicit wait
driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
(new WebDriverWait(driver, 120)).
until(ExpectedConditions.elementToBeClickable(By.id("some_id")));
암시 적 대기가 20 초로 다시 설정되는 것을 볼 수 없도록 코드를 단순화했습니다. 문제가 발생하면 어쨌든 거기에 도착하지 않습니다. WebDriverWait은 예외를 발생시킵니다.
May 16, 2017 3:36:11 PM org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.id:
some_id)
org.openqa.selenium.WebDriverException: TypeError: can't access dead object
가 geckodriver에 의해, 분명히, 일부 자바 스크립트 오류 출력이있다 : 또한
JavaScript error: chrome://marionette/content/listener.js, line 1555: TypeError: can't access dead object
*************************
A coding exception was thrown and uncaught in a Task.
Full message: TypeError: can't access dead object
Full stack: [email protected]://marionette/content/element.js:284:7
element.find/</findElements<@chrome://marionette/content/element.js:255:15
implicitlyWaitFor/</[email protected]://marionette/content/element.js:600:15
implicitlyWaitFor/<@chrome://marionette/content/element.js:627:5
[email protected]://marionette/content/element.js:593:10
element.find/<@chrome://marionette/content/element.js:254:24
[email protected]://marionette/content/element.js:253:10
[email protected]://marionette/content/listener.js:1314:19
[email protected]://gre/modules/Task.jsm:319:42
[email protected]://gre/modules/Task.jsm:277:3
createAsyncFunction/[email protected]://gre/modules/Task.jsm:252:14
[email protected]://gre/modules/Task.jsm:166:12
[email protected]://gre/modules/Task.jsm:389:16
[email protected]://gre/modules/Task.jsm:327:15
[email protected]://gre/modules/Task.jsm:277:3
createAsyncFunction/[email protected]://gre/modules/Task.jsm:252:14
[email protected]://gre/modules/Task.jsm:166:12
dispatch/<@chrome://marionette/content/listener.js:186:15
*************************
*************************
A coding exception was thrown and uncaught in a Task.
Full message: TypeError: can't access dead object
Full stack: [email protected]://marionette/content/element.js:284:7
element.find/</findElements<@chrome://marionette/content/element.js:255:15
implicitlyWaitFor/</[email protected]://marionette/content/element.js:600:15
implicitlyWaitFor/<@chrome://marionette/content/element.js:627:5
[email protected]://marionette/content/element.js:593:10
element.find/<@chrome://marionette/content/element.js:254:24
[email protected]://marionette/content/element.js:253:10
[email protected]://marionette/content/listener.js:1314:19
[email protected]://gre/modules/Task.jsm:319:42
[email protected]://gre/modules/Task.jsm:277:3
createAsyncFunction/[email protected]://gre/modules/Task.jsm:252:14
[email protected]://gre/modules/Task.jsm:166:12
[email protected]://gre/modules/Task.jsm:389:16
[email protected]://gre/modules/Task.jsm:327:15
[email protected]://gre/modules/Task.jsm:277:3
createAsyncFunction/[email protected]://gre/modules/Task.jsm:252:14
[email protected]://gre/modules/Task.jsm:166:12
dispatch/<@chrome://marionette/content/listener.js:186:15
, 내 자동 예외 예외는 대기 내부에서 해당 메시지가있다 TypeError: can't access dead object
말한다 처리는 스크린 샷을 가져 오려고하지만 동일한 오류로 실패합니다. 코드 라인은 다음과 같습니다
File snapshotTempFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
그리고 이번에는 geckodriver의 출력은 다음과 같습니다, 그래서
A coding exception was thrown and uncaught in a Task.
Full message: TypeError: can't access dead object
Full stack: [email protected]://marionette/content/capture.js:65:7
[email protected]://marionette/content/listener.js:1782:14
dispatch/</req<@chrome://marionette/content/listener.js:188:22
[email protected]://gre/modules/Task.jsm:319:42
[email protected]://gre/modules/Task.jsm:277:3
createAsyncFunction/[email protected]://gre/modules/Task.jsm:252:14
[email protected]://gre/modules/Task.jsm:166:12
dispatch/<@chrome://marionette/content/listener.js:186:15
내가 제대로이 작품을 만들기 위해 무엇을 할 수 있습니까? 그리고 내가 geckodriver 버그로 키울 필요가 뭔가?
Google에서 유일하게 할 수있는 것은 https://github.com/mozilla/geckodriver/issues/614이고 제안 된 유일한 해결책은 driver.switchTo().defaultContent()
입니다. 이건 내 스크린 샷 루틴을 고칠 수 있지만, 기다리는 요소는 콘텐츠 프레임 안에 있으므로 잠깐 동안이 픽스를 사용할 수는 없습니다.
감사합니다! 이것은 효과가있다. (중괄호 초기화 대신 별도의 클래스 정의를 사용하도록 수정했습니다.) 결국 geckodriver 추적기에서 문제를 발견했으며,이 답변을 통해 의견을 입력하는 방법을 알고있었습니다. 문제는 https://github.com/mozilla/geckodriver/issues/614에서 확인할 수 있습니다. –