【问题标题】:Protractor IE 11 Error - Failed to find elementProtractor IE 11 错误 - 无法找到元素
【发布时间】:2015-07-02 03:08:04
【问题描述】:

使用以下语法查找用户名输入文本框,

browser.findElement(By.id('username'));

在 Chrome 和 Firefox 中运行良好,但在 IE 11 中出现以下错误:

    [internet explorer #3]   Message:
    [internet explorer #3]     Failed: Finding elements with id ==usernamereturned an unexpected error (WARNING: The server did not provide any stacktrace information)
    [internet explorer #3]     Command duration or timeout: 970 milliseconds
    [internet explorer #3]     For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
    [internet explorer #3]     Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
    [internet explorer #3]     System info: host: 'dev-web-01', ip: '10.126.1.32', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_45'
    [internet explorer #3]     Driver info: org.openqa.selenium.ie.InternetExplorerDriver
    [internet explorer #3]     Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false
    expectedAlertBehaviour=dismiss}]
    [internet explorer #3]     Session ID: d593cfc5-74a5-445a-b1b8-fcdf7c372786
    [internet explorer #3]     *** Element info: {Using=id, value=username}

我已经按照以下两个站点来配置 IE: seleniumQuery Run Protractor Against Internet Explorer VM

【问题讨论】:

    标签: javascript internet-explorer testing protractor e2e-testing


    【解决方案1】:

    我知道这篇文章是 2 年前发布的,但我想发布这篇文章,以便对有类似问题的人有用。我在具有 2012 窗口服务器、IE11、3.12 IEdriver、5.3 量角器、8.0.1 承诺、0.9.5 黄瓜的云服务器中工作。

    脚本正在打开 IE,但在我进行以下更改之前无法识别任何对象。

    1. IE11 不能与直接连接一起使用。端口 4444 对我不起作用。
    2. 更改以下设置: 2.1 启用保护模式 - 在 IE11 的所有区域中打开或关闭 2.2 Zone -> Internet-> Custom -> Scripting -> Active Scripting -> Enable
    3. 带有 Cucumber 框架的配置文件

      exports.config = {
          getPageTimeout: 60 * 1000,
          allScriptsTimeout: 100 * 60 * 1000,
          restartBrowserBetweenTests: false,
      
          capabilities: {
              browserName:'internet explorer',
              version: 'ANY',
      
              restartBrowserBetweenTests: true,
              shardTestFiles: false,
              maxInstances: 1,
              enableElementCacheCleanup: true,
              javascriptEnabled: true,
              ignoreProtectedModeSettings: true
          },
          framework: 'custom',
          frameworkPath: require.resolve('protractor-cucumber-framework'),
          ignoreUncaughtExceptions: true,
      
          specs: [
              '../SystemStatus/*.feature'
          ],
          cucumberOpts: {
              require: ['../SystemStatus/SystemStatus.steps.js'],
              format: 'json:../../report/SystemStatus'+ timeStamp + '/report.json',
              //format: ['pretty'],
              //tags: [],
              strict: true,
              dryRun: false,
              compiler: [],
              tags: '@Login'
      
          },
      
      
          plugins: [{
              package: require.resolve('protractor-multiple-cucumber-html-reporter-plugin'),
              options:{
                  automaticallyGenerateReport: true,
                  removeExistingJsonReportFile: true
              }
          }]
      
      };
      

    【讨论】:

      猜你喜欢
      • 2016-01-13
      • 1970-01-01
      • 2014-01-27
      • 2012-08-11
      • 2015-09-17
      • 2017-12-08
      • 1970-01-01
      • 2014-12-30
      • 2021-05-18
      相关资源
      最近更新 更多