2016-04-26 172 views
0

我正在創建一個頁面使用硒web驅動程序的對象模型,並嘗試鏈接具有'href'的元素。通過這種方式selenium webdriver通過'href'查找元素不工作使用java

[element = driver.findElement(By.partialLinkText("signin")).click();]

創建我越來越喜歡

錯誤不能隱蔽從空隙 - 網頁元素。

能有人能幫助我在瀏覽器這個

+0

堆棧跟蹤始終歡迎。 – SkorpEN

回答

0

首先選擇元素,並把它複製的選擇(檢查 - >副本選擇)。然後將其用作cssSelector。儘量不要使用鏈接文本,因爲它依賴於語言。

0

喜你得到上面的錯誤,因爲

element = driver.findElement(By.partialLinkText("signin")).click(); 

you are trying to perform action (i.e click) and its object identification (element =...) 
together whic h is not correct to make it work plz do it like below 
element = driver.findElement(By.partialLinkText("signin")); 
element .click(); 

而且你爲什麼收到錯誤「不能從無效隱蔽到網頁元素」cause the type of .click() is void for more information please look at official documentationhttp://seleniumhq.github.io/selenium/docs/api/java/index.html 現在就停止給你錯誤的希望這可以幫助您

相關問題