selenium問題:Link has target '_blank', which is not supported in Selenium!

詳細描述:如果你要點擊的鏈接代碼是這樣:

<a target="_blank" href="http://www.baidu.com" >&nbsp;</a>那麼由於target="_blank",點擊這個鏈接會打開一個新的窗體。在新窗體中打開對應的href。但是由於slenium不能保證正確找到新打開的窗體會報這個錯。

[warn] Link has target '_blank', which is not supported in Selenium! Randomizing target to be: selenium_blank28995

這樣在如果需要操作新窗體中的元素的話slenium報錯說找不到元素之類的。關於這個問題的解決辦法有前輩已經總結:

http://bbs.51testing.com/thread-206903-1-1.html

我覺得其中第一種方法取href再open的方式最簡單也最實用。

發佈了12 篇原創文章 · 獲贊 2 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章