差異處
這裏顯示兩個版本的差異處。
rf:rf:noactivesessionproblem [2017/12/21 18:14] tony [Problem] |
rf:rf:noactivesessionproblem [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== No active session with ID problem ====== | ||
- | ===== Problem ===== | ||
- | 這陣子將SeleniumLibrary升級至3.0.0,且selenium node中的server升級至3.8.1、firefox使用Mozilla GeckoDriver 0.19.0。沒想到當天晚上跑完自動測試後,出現了大量錯誤,其中一個就是No active session with ID:\\ | ||
- | {{:rf:rf:rf_problem_no_active_session_with_id.png|}}\\ | ||
- | 在發生問題後,如果執行除了Open Browser以外的動作,如Set Selenium Timeout、Capture Page Screenshot或Close All Browsers,就會出現如上述訊息,而selenium node上的機器會有大量的瀏覽器開啟且沒有關閉。\\ | ||
- | \\ | ||
- | 本篇文章主要分享我發現的原因與避掉方式。 | ||
- | ===== How to? ===== | ||
- | 經過trace,在我們的測試中,必須經過一定步驟才會發生問題。以下是我簡化模擬出來的情況:\\ | ||
- | {{:rf:rf:rf_selenium_session_problem_with_multiple_close.png|}}\\ | ||
- | 在testcase 1中close window後,目標機器瀏覽器會被關閉,這也導致close all browser會出問題;而在testcase 2雖然重新啟動了一個新的瀏覽器,但selenium卻無法獲得新的session id。\\ | ||
- | \\ | ||
- | 因此,最後將重複關閉(Close Window)的行為給拿掉就可以"避掉"問題了。 | ||