我尝试使用 driver.find_element_by_id // link_text // 部分链接文本,我应该使用什么来访问这个 href。我收到 No such Element Exception 。任何帮助将不胜感激 tysm。
<a href="../s-reminderNotice.asp?fname=b%2D3c%2DpLessonBooking%2Easp%3Flimit%3Dpl"
class="sidelinkbold" target="mainFrame" onmouseover="
window.status='Practical Training Booking'; return true" onmouseout="window.status=' ';
return true">Booking without Fixed Instructor</a>
解决了;元素在 IFRAME 中;不得不将框架切换到访问元素
答案 0 :(得分:0)
尝试使用下面的 WebElement 然后点击它:
//a[contains(text(),'Booking without Fixed Instructor')]
答案 1 :(得分:0)
driver.find_element_by_class_name("sidelinkbold").click()
它有一个简单的类名,可以用来点击。
答案 2 :(得分:0)
尝试使用:
webDriver.findElement(By.xpath("//a[@href='YOUR LINK']")).click();