2013-03-03 143 views
0

我正在嘗試使用Selenium來導航網頁。有一個按鈕我試圖通過它的xpath。對於網站上的其他按鈕,它工作正常。但是對於這個特定的人,我總是收到元素無法找到的錯誤。 Firebug只是以這種格式給我xpath:// * [@ id =「continueButton」]。在Selenium中查找XPath的元素

我注意到按鈕周圍有包裝。它們的結構類似於

<div class = "cButtonWrapper"> 
    <div class = "cButtonHolder"> 
    <input type="image" id="continueButton" name="Continue" alt="Continue" src="/store/images/btn_continue.gif" value="Continue"> 
    </div> 
</div> 

按鈕周圍的包裝可能與無法找到它有關嗎?

回答

0

也許<input>元素無法通過XPath正確定位,因爲您使用的是無效HTML。嘗試在您的網頁來源中使用<input id="continueButton"/><input id="continueButton"></input>

相關問題