gpt4 book ai didi

selenium - 无法使用 Selenium 和 IEWebDriverServer 3.4.0 在 Windows Server 2016 上针对 IE11 运行自动化测试

转载 作者:行者123 更新时间:2023-12-03 10:06:23 24 4
gpt4 key购买 nike

  • 操作系统:Windows Server 2016 数据中心(64 位)
  • 浏览器:Internet Explorer 11.0.14393.0
  • Protractor :5.1.2
  • Selenium 服务器独立版:3.4.0
  • IEWebDriverServer.exe:3.4.0
  • Java:1.8.0_131

  • 我们正在尝试在 Windows Server 2016 虚拟机上针对 Internet Explorer 11 运行自动化测试。测试可以通过 Selenium 服务器在 VM 上针对 Chrome 执行,但在 IE 中失败。

    当针对 IE Protractor 运行时,它能够启动在 IE 中打开的 Selenium 服务器。然后在地址栏中使用“about:blank”启动另一个窗口。这很快关闭,控制台窗口中显示以下错误:
    [13:57:18] I/launcher - Running 1 instances of WebDriver  
    [13:57:18] I/local - Starting selenium standalone server...
    [13:57:19] I/local - Selenium standalone server started at http://10.X.X.X:61263/wd/hub
    Started
    A Jasmine spec timed out. Resetting the WebDriver Control Flow.

    Failures:
    1) angularjs homepage todo list should add a todo
    Message:
    Failed: JavaScript error (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 26 milliseconds
    Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
    System info: host: 'XXXX', ip: '10.X.X.X', os.name: 'Windows Server 2016', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
    Driver info: org.openqa.selenium.ie.InternetExplorerDriver

    从 Web 驱动程序的进一步日志记录发现了许多 [访问被拒绝。] 问题:
    D 2017-06-22 10:43:26:213 BrowserFactory.cpp(248) Starting IE using the IELaunchURL API  
    D 2017-06-22 10:43:26:360 BrowserFactory.cpp(202) IE launched successfully with process ID 4612
    D 2017-06-22 10:43:26:360 BrowserFactory.cpp(208) Process with ID 4612 is executing iexplore.exe
    D 2017-06-22 10:43:26:360 BrowserFactory.cpp(375) Using Active Accessibility to find IWebBrowser2 interface
    D 2017-06-22 10:43:27:615 BrowserFactory.cpp(434) Found window handle 000A017A for window with class 'Internet Explorer_Server' belonging to process with id 4612
    D 2017-06-22 10:43:27:636 BrowserFactory.cpp(396) Ignoring zoom setting: 0
    W 2017-06-22 10:43:27:644 BrowserFactory.cpp(664) -2147024891 [Access is denied.]: Call to IHTMLWindow2::get_screen failed

    I 2017-06-22 10:43:28:028 Browser.cpp(130) No child frame focus. Focus is on top-level frame
    W 2017-06-22 10:43:28:040 Script.cpp(494) -2147024891 [Access is denied.]: Unable to execute code, call to IHTMLWindow2::execScript failed
    W 2017-06-22 10:43:28:040 Script.cpp(180) Cannot create anonymous function
    W 2017-06-22 10:43:28:040 response.cc(77) Error response has status code 17 and message 'JavaScript error' message


    很明显 IE 中存在权限问题,但是浏览器安全设置的松动并没有产生任何影响。

    我尝试过的:
  • 将所有区域的“启用保护模式”设置为禁用
  • 将“允许 Microsoft Web 浏览器控件的脚本”设置为启用
  • 尝试了许多 IEWebDriverServers,包括 32 位和 64 位版本
  • 试过 IE11 32 位和 64 位
  • 为 32 位和 64 位 IE 实例添加了 2 个注册表项 FEATURE_BFCACHE ( https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver )
  • 禁用“增强保护模式”
  • 本文提到的配置:http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/

  • 有没有人成功地让 IEDriverServer 在 Windows Server 2016 上运行?我怎样才能解决这些访问被拒绝的问题?

    Protractor 配置:
    exports.config = {

    capabilities: {
    'browserName': 'internet explorer',
    'platform': 'WINDOWS',
    'version': '11'
    },

    seleniumServerJar: '<absolute path to /npm/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar>',

    localSeleniumStandaloneOpts : {
    jvmArgs : ["-Dwebdriver.ie.driver.loglevel=DEBUG", "-Dwebdriver.ie.driver.logfile=C:/IEServerlog.log", "-Dwebdriver.ie.driver=<absolute path to /npm/node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer3.4.0.exe>"]
    },

    specs: ['spec.js']
    };

    规范.js:
    describe('angularjs homepage todo list', function() {
    it('should add a todo', function() {
    browser.get('https://angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
    });
    });

    最佳答案

    我在使用其他版本的 webdriver-manager 时遇到了这个问题。使用 3.4.0 解决了

    webdriver-manager update --versions.standalone=3.4.0 --ie32 

    更新 webdriver-manager 到 3.4.0 并启动具体的 3.4.0
    webdriver-manager start --versions.standalone=3.4.0

    你应该可以在IE浏览器中运行。

    关于selenium - 无法使用 Selenium 和 IEWebDriverServer 3.4.0 在 Windows Server 2016 上针对 IE11 运行自动化测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44690863/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com