无法单击Icon的元素

时间:2015-07-06 02:23:23

标签: jquery selenium xpath selenium-webdriver

我对硒有点新鲜,我遇到了一个我无法点击的图标元素。请看下面的详细信息。

enter image description here

尝试了这个相对的xpath,并且在运行我的脚本时仍然发生了noElementException。

.//*[@id='inforWsAppList']/li[2]/a

感谢所有愿意分享他们想法的人们!

尝试了切换帧方法,但仍然没有运气:

 WebElement iframeElement = driver.findElement(By.id("lid://infor.social.mingleinstance1")); // This is the iframe that you're saying 
        driver.switchTo().frame(iframeElement);
        driver.findElement(By.name(".//*[@id='inforWsAppList']/li[2]/a")).click();   // or [@id='inforWsAppList']/li[2] 
        driver.switchTo().defaultContent();
        //

1 个答案:

答案 0 :(得分:2)

如果仔细查看元素所在的位置,您会注意到iframe作为父母之一。您需要首先切换到iframe

相关问题