我無法點擊圖像 - >地圖 - >區域標記中的鏈接。任何人都可以幫助我解決這個問題。我想單擊否(或)關閉。如何點擊使用硒的圖像上的鏈接java
<div id="IPEinvL" style="z-index: 10000; width: 439px; height: 360px; left: 463px; top: 0px; background-color: white; position: absolute; margin-left: 0px; margin-top: 0px;">
<img alt="Would you like to participate in a short study?" usemap="#IPEMap" src="XXXXXXXXXXXXXXXXXXXX.png" border="0" height="360" width="439">
<map name="IPEMap">
<area shape="rect" coords="405,15,424,33" href="javascript:clWin()" alt="close">
<area shape="rect" coords="117,229,214,258" href="javascript:fOpen()" alt="yes">
<area shape="rect" coords="225,229,323,258" href="javascript:clWin()" alt="no">
</map>
<img id="countInvites" src="XXXXXXXXXXXXXXXXX/Counter/counter_N.png?surveyID=120799&siteID=1&langID=1&traceID=2" style="border: 0px; margin-top: -10px;" alt="" height="0" width="0">
</div>
我都試過3種方法得到下面的異常org.openqa.selenium.NoSuchElementException:找不到元素:// * [@ id ='IPEinvL']/img/map/area [@ alt ='close'] –
抱歉xpath錯誤應該是// * [@ id ='IPEinvL']/map/area [@ ALT = '關閉'。請檢查更新的xpath – Murthi
Xpath // * [@ id ='IPEinvL']/map/area [@ alt ='close']。爲我工作。它拯救了我的一天。謝謝! –