在java中使用硒。我們有一系列看似大致相同的鏈接:試圖點擊鏈接通過在java中的硒
<a href='javascript:newWin("/ABC")'>ABC</a>
我們正在嘗試點擊該鏈接。不幸的是沒有id。我們已經嘗試了以下幾條內容。
driver.findElement(By.xpath("(//[contains(@href, 'javascript:newWin')])")).click();
導致:
Unable to locate an element with the xpath expression (//[contains(@href, 'javascript:newWin')]) because of the following error: [object Error] (WARNING: The server did not provide any stacktrace information)
我們試圖找出如何XPath來錨,並點擊它。我們無法獲得身份證件(至少現在還沒有)。