Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium 无法从webdriver中找到新的刷新帧,然后找不到该帧的元素_Selenium - Fatal编程技术网

Selenium 无法从webdriver中找到新的刷新帧,然后找不到该帧的元素

Selenium 无法从webdriver中找到新的刷新帧,然后找不到该帧的元素,selenium,Selenium,我对硒很陌生。我正在尝试自动化我的EMS/NMS测试用例。 测试环境:我的网页实际上是一个NMS操作应用程序[它是一个私有网页]。现在主页的来源是: <html> <head> <frameset bordercolor="gray" border="3" rows="10%,90%"> <frame scrolling="no" bordercolor="black" src="/cgi-bin/portal.cgi" noborder="" name

我对硒很陌生。我正在尝试自动化我的EMS/NMS测试用例。 测试环境:我的网页实际上是一个NMS操作应用程序[它是一个私有网页]。现在主页的来源是:

<html>
<head>
<frameset bordercolor="gray" border="3" rows="10%,90%">
<frame scrolling="no" bordercolor="black" src="/cgi-bin/portal.cgi" noborder="" name="start_tab">
<html>
   <head>
      <body bgcolor="white">
         <style type="text/css">
|
            <a target="showcase" href="/Portal/sonm/cgi-bin/welcome">Ckt</a>
|
           <a target="showcase" href="/cgi-bin/build_instpage">EM Inst</a>
|
           <a target="showcase" href="/Portal/BAT/cgi-bin/bat_welcome.pl">System Check</a>
|
            <a target="showcase" href="/Portal/SOEM-GUI/cgi-bin/soem_welcome">EM</a>
|
         </body>
      </html>
    </frame>

|
|
|
|
|

现在,从上面开始,我可以点击“EM”,当我点击它时,它位于第一个名为“start_tab”的框架上,另一个页面没有打开,而是第二个框架被刷新,并出现一个登录按钮。现在我需要访问这个登录按钮。但是,我无法找到此登录按钮。这方面的Src代码为:

<script language="Javascript">
<table>
    <tbody>
        <tr>
           <td width="100%" align="center">
              <table>
                 <tbody>
                       <tr>
                          <td width="100%" align="center">
                              <a href="http://actual button">
                                 <img style="< border="" src="http://login_btn.png">
                               </a>
                           </td>
                       </tr>
                </tbody>
           </table>

我尝试过,按钮使用xpath,我尝试过使用标记名,但我想我无法进入这个新的刷新框架。另外,当我获取源代码时,我会获取上一帧的源代码

只需添加,整个页面分为两页: 1) “开始”选项卡,其中包含所有链接 2) showcase将根据单击的链接使用内容刷新

除了JavaDocs for webdrvier之外,还有什么好的文档,其中讨论了不同的web应用程序测试场景


提前谢谢

在定位按钮之前,您需要切换到帧

driver.switchTo().defaultContent(); // you are now outside of current frame  
driver.switchTo().frame("start_tab");
// now add code to locate login button

@卡娜,谢谢!但我做了同样的事情,对于start_选项卡,帧不会刷新,但当我单击链接时,第二帧会刷新,当我切换到该链接时,我无法找到“按钮”。@user3543782它是嵌套帧吗?添加一些相关的HTML@Karna-使用默认内容开关,我可以切换到showCase!非常感谢,然后使用xpath我可以找到我的按钮并单击它。@user3543782很高兴我能帮上忙!如果答案解决了您的问题,请将其标记为已接受。@Karna-很抱歉,在任何地方都找不到“已接受”选项卡。