如何使用selenium在ASP源代码中查找元素?

如何使用selenium在ASP源代码中查找元素?,selenium,selenium-webdriver,asp-classic,Selenium,Selenium Webdriver,Asp Classic,这两个框架中的内容只是asp源代码,所以我无法使用selenium的常规FindElement方法在这两个框架中找到元素 有没有办法找到这些元素 找到所需的帧,并使用switchTo()切换到该帧。Java中的示例: <frame name="top" src="../LoginOrder/announcements.asp"> <frame name="bottom" src="../LoginOrder/menu_bar.asp" scrolling="no"> 这

这两个框架中的内容只是asp源代码,所以我无法使用selenium的常规FindElement方法在这两个框架中找到元素


有没有办法找到这些元素

找到所需的帧,并使用
switchTo()
切换到该帧。Java中的示例:

<frame name="top" src="../LoginOrder/announcements.asp">
<frame name="bottom" src="../LoginOrder/menu_bar.asp" scrolling="no">
这里我们检查框架的
src
属性中是否存在
announcements
文本

WebElement frame = driver.findElement(By.cssSelector("frame[src*=announcements]"));
driver.switchTo().frame(frame);