Selenium抛出错误的NoSuchElementException抛出

时间:2018-05-18 09:11:19

标签: c# selenium

我面临的奇怪问题是:

  1. 测试Chrome浏览器时测试失败: enter image description here
  2. 这是我在测试镀铬时所得到的。

    1. 当测试FireFox时,我确实得到了这个: enter image description here
    2. 我做了一些谷歌搜索,页面上没有框架..一般来说,我主张抛出异常,但它有点不对。?

      非常感谢任何帮助,因为我对硒这么新,基本上是第一次测试尝试之一:)

      更新: - 在测试运行时添加加载的html:

      
      
      <body>
      <div id="react-app">
          <div data-reactroot="" class="container-fluid">
              <div class="row">
                  <div class="col-sm-1">
                  </div>
                  <div class="col-sm-10">
                      <div>
                          <div>
                              <h1>Customer</h1>
                              <div>
                                  <select id="customer-id">
                                      <option value="BAH">BA Holidays</option>
                                      <option value="CHEAPCARIB">CheapCaribbean</option>
                                      <option value="DELTA">Delta Vacations</option>
                                      <option value="1TEST">1 Vacations</option>
                                      <option value="LATAM">LATAM</option>
                                      <option value="SPIRIT">Spirit Airlines</option>
                                      <option value="THOMASCKUK">Thomas Cook UK</option>
                                  </select>
                              </div>
                              <div>
                                  <h2>Profile</h2>
                                  <select id="profile-id">
                                      <option value="DL_FH">DL_FH</option>
                                      <option value="DL_FHM">DL_FHM</option>
                                  </select>
                              </div>
                              <div>
                                  <button id="download-order-template" class="ui-button ui-widget ui-state-default ui-corner-all">
                                  <span class="ui-button-text ui-c">
                                  Download Template
                                  </span>
                                  </button>
                              </div>
                              <div>
                                  <h2>Place a new standalone order</h2>
                                  <span class="ui-button ui-fileupload-choose ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
                                  <span class="ui-button-icon-left fa fa-plus">
                                  </span>
                                  <span class="ui-button-text ui-clickable">
                                  Select File To Upload
                                  </span>
                                  <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                                  </span>
                              </div>
                              <div>
                                  <h2>Replace all Subscriptions</h2>
                                  <span class="ui-button ui-fileupload-choose ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
                                  <span class="ui-button-icon-left fa fa-plus">
                                  </span>
                                  <span class="ui-button-text ui-clickable">
                                  Select File To Upload
                                  </span>
                                  <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                                  </span>
                              </div>
                              <h2>Subscription Lines</h2>
                              <div>
                                  <h3 id="no-subscriptions-message">
                                      No subscriptions are available for selected profile
                                  </h3>
                              </div>
                          </div>
                      </div>
                  </div>
                  <div class="col-sm-1">
                  </div>
              </div>
          </div>
      </div>
      <script src="/dist/vendor.js?v=FSqTLWksDyRJ8ISowkFa5SF8Km7z2u2VqPZf0m3lpXA"></script>
      <script src="/dist/main.js?v=zuIW3HpayKUQgmfsu0Hi17_VJILvxurljy9Fv0yHLMA"></script>
      </body>
      &#13;
      &#13;
      &#13;

1 个答案:

答案 0 :(得分:0)

例外情况没有什么不同,因为它们遵循Selenium框架中的相同指南,但每个WebDriver可以选择添加其他调试信息来帮助修复其底层引擎中的问题(特定于每个浏览器疗程)。

ChromeDriver往往更多&#34; chatty&#34;关于错误,如果您只关心测试套件的结果,请忽略这些错误。