2016-04-26 171 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 现在就停止给你错误的希望这可以帮助您

相关问题