在測試過程中發現頁面上有兩個保存按鈕的元素的xpath一模一樣,如下圖:
google了好久才找到解決辦法,發現自己還是比較弱!!!解決方法如下:
selenium.click("xpath=(//button[.='保存'])[last()]");
使用 last() 這個函數(我去,xpath還支持函數!!!)
其它函數請查看下面的網頁:http://automationtricks.blogspot.com/2010/09/how-to-locate-element-which-have-same.html
--------------------- 本文來自 su1322339466 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/su1322339466/article/details/51770326?utm_source=copy