在IDE中使用openWindow命令後,我遇到了焦點問題。此問題僅適用於同一測試套件中的第二個測試用例試圖與新打開的窗口進行交互的情況。例如,我有一個測試套件包括單獨的測試用例執行以下操作:在Selenium IDE中打開新窗口後保持焦點
- 登錄到站點A
- 輸入一些交易數據
- 提交該交易審批
- 打開一個新窗口並登錄到站點B
- 批准站點B的交易,並關閉窗口
- 繼續在現場處理事務A
如果我在與「openWindow」相同的測試用例中執行測試用例5「站點B」操作(即,合併測試用例4和5),那麼所有命令都會執行而不會出錯。如果我在不同的測試用例中執行相同的操作,那麼新窗口失去焦點,所有的Selenium命令都會返回到原始窗口。
的這個有趣的部分是試圖鑑定和在步驟5
在測試情況下5個會導致錯誤消息「窗口不存在執行「selectWindow名= siteB_URL」重新選擇「新」的窗口。如果這看起來像一個硒臭蟲...「。
然後,我想我會調用storeAllWindowNames並回顯結果,至少可以看到Selenium在各個點都知道的窗口名稱。如果我將它作爲測試用例4中的最後兩條命令,我會得到預期的結果 - 記錄「echo,siteB_URL」。如果我在測試用例五的前兩行做同樣的事情,我會得到「回聲」。這是讓我感受到的部分 - 只是改變測試用例似乎失去了對新窗口的引用。
有沒有人想過在Selenium IDE中解決這個問題的方法或解決方案?
我已經花了幾個小時今早沖刷網絡和各種論壇尋找建議無濟於事。
由於提前,
格倫
12年4月7日 - 更新 - 這裏的上述場景的一個簡單的例子:
[info] Executing: |openWindow | http://www.google.com.au | google2 |
[info] Executing: |selectWindow | google2 | |
[info] Executing: |storeAllWindowNames | allWindows | |
[info] Executing: |echo | ${allWindows} | |
[info] echo: ,google2
[info] Changed test case
[info] Executing: |storeAllWindowNames | allWindows | |
[info] Executing: |echo | ${allWindows} | |
[info] echo:
[info] Executing: |selectWindow | name=google2 | |
[error] Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.
我有同樣的問題。你是否解決了這個問題,還是仍然存在問題?請分享您的經驗! – herry