我对硒有点新鲜,我遇到了一个我无法点击的图标元素。请看下面的详细信息。
尝试了这个相对的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();
//
答案 0 :(得分:2)
如果仔细查看元素所在的位置,您会注意到iframe
作为父母之一。您需要首先切换到iframe
。