我在使用guide來學習使用python進行TDD。在some point,做遷移後,命令python3 functional_tests.py
的輸出應該是(根據書):Selenium無法訪問死對象/元素引用已過時
self.fail('Finish the test!')
AssertionError: Finish the test!
但我得到的錯誤:
selenium.common.exceptions.InvalidSelectorException: Message: Given css selector expression "tr" is invalid: TypeError: can't access dead object
,並試圖第二次(或更多)的時間後:
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference is stale. Either the element is no longer attached to the DOM or the page has been refreshed.
我一直在谷歌搜索和搜索類似的問題,但沒有找到一個可以幫助我解決問題。
我正在使用geckodriver,並將其添加到PATH
的路徑中。
Django==1.8.7
selenium==3.0.2
Mozilla Firefox 50.0.2
(X)Ubuntu 16.04
我應該切換到Chrome嗎?這不是微不足道的,它需要我一段時間,但它可以工作嗎?更像Firefox還是Selenium?我不認爲它是代碼相關的 - 我克隆了repo for chapter 5並且同樣的崩潰正在發生。
恕我直言,對Chrome的支持看起來好多了。這是一種微不足道的,通過apt(對不起剛纔debian cmds /名字)和鉻符號鏈接到/ usr/bin/chrome並且你完成了(關於轉換爲鉻),通過apt來獲得chromedriver和chromium。 –