詳細描述:如果你要點擊的鏈接代碼是這樣:
<a target="_blank" href="http://www.baidu.com" > </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的方式最簡單也最實用。