Selenium测试但每次都发生错误StaleElementReferenceException

时间:2018-01-19 11:33:12

标签: java selenium java-8 cucumber gherkin

我使用库编写Java 8中的测试脚本:

  • selenium-java ver 3.8.1,
  • cucumber-java,cucumber-junit,cucumber-core cucumber-java8,cucumber-picocontainer ver 1.2.5
  • gherkin ver 2.12.2

我使用了页面对象模式和PageFactory.initElements(驱动程序,这个); 和注释@FindBy() 在代码中,我使用了WebDriverWait,FluentWait元素,但没有任何利润。 有人知道如何解决这个错误吗?:

      org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
    (Session info: headless chrome=60.0.3112.101)
    (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-77-generic x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 0 milliseconds
  For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
  Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
  System info: host: 'officeDevelopmentServer', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-77-generic', java.version: '1.8.0_151'
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.31.488763 (092de99f48a300..., userDataDir: /tmp/.org.chromium.Chromium...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 60.0.3112.101, webStorageEnabled: true}

0 个答案:

没有答案