GVKun编程网logo

Internet Explorer 8 64位和Selenium无法正常工作

4

本文将介绍InternetExplorer864位和Selenium无法正常工作的详细情况,。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于angularjs

本文将介绍Internet Explorer 8 64位和Selenium无法正常工作的详细情况,。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于angularjs – Angular和Internet Explorer 11 – 输入无法正常工作、angularjs – Internet Explorer Selenium量角器e2e测试、asp.net-mvc – 如何运行Internet Explorer Selenium测试作为一个特定的域用户?、Docker,Django和Selenium-Selenium无法连接的知识。

本文目录一览:

Internet Explorer 8 64位和Selenium无法正常工作

Internet Explorer 8 64位和Selenium无法正常工作

我正在尝试运行selenium测试。但是,每次尝试运行应该运行IE的测试时,我都会在htmlutils.js的863行收到错误消息,它表示我应该禁用弹出窗口阻止程序。事情是我去了IE工具->弹出窗口块。

所以它被禁用,我得到这个错误。

还有什么我需要禁用的吗?实际上,我什至不知道它正在运行哪个版本的Internet Explorer,因为我使用的是Windows 7 Pro
64位版本。因此,当我使用IE时,我使用的是64位版本,但是我正在了解该网站或类似网站是否不支持64位,它将变为32位。

所以不确定我需要做什么才能使其正常工作。

这是行

function openSeparateApplicationWindow(url, suppressMozillaWarning) {    // resize the Selenium window itself    window.resizeTo(1200, 500);    window.moveTo(window.screenX, 0);    var appWindow = window.open(url + ''?start=true'', ''selenium_main_app_window'');    if (appWindow == null) {        var errorMessage = "Couldn''t open app window; is the pop-up blocker enabled?"        LOG.error(errorMessage);        throw new Error("Couldn''t open app window; is the pop-up blocker enabled?");    }

该log.error消息存储在哪里?也许我也可以发布。

答案1

小编典典

我在Vista和IE8上遇到类似的问题,但会收到相同的错误消息

Couldn''t open app window; is the pop-up blocker enabled?"

以管理员身份运行我的遥控器不是我的选择,而且从安全角度来看也是一个糟糕的主意。因此,最后我设法通过将浏览器从“ * ietha”更改为“ *iexploreproxy” grid_configuration.yml来解决了这个问题

hub:  port: 4444    ...    - name: "Internet Explorer 8 on Vista"      browser: "*iexploreproxy"    ...

另外,您可以从代码中更改浏览器字符串:

ISelenium selenium = new DefaultSelenium("localhost", 4444, "*iexploreproxy", "http://www.google.com/");

奇迹般有效。剩下的唯一问题是这是否会以某种方式影响测试用例的结果。到目前为止,还没有,但我将更新此答案,以防万一。

angularjs – Angular和Internet Explorer 11 – 输入无法正常工作

angularjs – Angular和Internet Explorer 11 – 输入无法正常工作

我在IE中使用ng-model(11和所有以前的版本)的输入存在严重问题,但一切都在所有其他浏览器中正常工作.这个问题上周首次出现.我们没有对我们的应用程序的这一部分进行任何更新,并且在上周之前没有收到有关此问题的用户的报告.

我们正在运行Angular 1.4.3.

基本上,像这样的输入:

<input data-ng-model="answer.value"></input>

未正确更新模型.看起来像onChange或onFocus事件的问题 – 输入永远不会丢失他们的ng-pristine和ng -notouched类.它们正在从模型中正确显示初始值,但用户所做的任何更新都无法保存.我们已经尝试添加< Meta http-equiv =“X-UA-Compatible”content =“IE = 11”/>标记到我们的头上无济于事.从输入中删除所有验证没有任何区别.没有控制台错误或警报.

解决方法

我有simillar问题,解决方案似乎很容易.如果你有类似的代码:

<form name="myForm">
    <table ng-disabled="formToggle">
        ...
        <input ng-model="form.name" />
        ...
    </table>
</form>

IE10,IE11不会检查字段,也不会在表单上设置原始的脏值(其他浏览器工作正常).只需删除ng-disabled(在这种情况下从表中,在其他情况下从父元素),它将工作.

angularjs – Internet Explorer Selenium量角器e2e测试

angularjs – Internet Explorer Selenium量角器e2e测试

我想在CI构建过程中添加一些e2e测试.我已经针对chrome firefox添加了它们(作为最简单的).但我真的想为几个IE版本做这件事.如何在 linux / mac上的构建过程中注入它?

我找到了这样的文章:
http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/

但看起来它不是我需要的100%.有人可以提供简单的配置样本吗?

你需要一个 selenium server,你自己,或 browserstack/ SauceLabs.如果您计划自己完成,简而言之,您需要设置一个selenium网格并注册节点,其中一个节点应该是一台Windows机器,您可以在其中运行针对IE的测试.

就个人而言,我已成功在多个浏览器上运行量角器e2e测试,包括在browserstack上的不同Chrome,Firefox和IE版本.这是我使用的配置(它还包括jasmine junit reporter,CI需要这个):

'use strict';

var browserstackUser = 'user';
var browserstackKey = 'key';

exports.config = {
    multiCapabilities: [
        {
            'browserstack.user': browserstackUser,'browserstack.key': browserstackKey,'browserstack.local': 'true','browserstack.debug': 'true','browserName': 'Chrome','os': 'Windows','os_version': '8','resolution': '1024x768',specs: [
                '*.spec.js'
            ],exclude: [
                'footer.disabledCookies.spec.js'
            ]
        },{
            'browserstack.user': browserstackUser,'browser': 'Internet Explorer','browser_version': '8.0','os_version': '7',specs: [
                '*.spec.js'
            ]
        },'browserName': 'Internet Explorer','browser_version': '9.0',exclude: [
                'footer.disabledCookies.spec.js'
            ]
        }
    ],// browserstack's selenium server address
    seleniumAddress: 'http://hub.browserstack.com/wd/hub',framework: 'jasmine',allScriptsTimeout: 300000,baseUrl: 'http://localhost:9001',onPrepare: function () {
        require('jasmine-reporters');
        var capsPromise = browser.getCapabilities();
        capsPromise.then(function (caps) {
            var browserName = caps.caps_.browserName.toupperCase();
            var browserVersion = caps.caps_.version;
            var prePendStr = browserName + "-" + browserVersion + "-";
            jasmine.getEnv().addReporter(new
                jasmine.JUnitXmlReporter("test-results",true,prePendStr));
        });
    },jasmineNodeOpts: {
        showColors: true,isverbose: true,includeStackTrace: true,defaultTimeoutInterval: 3600000
    }
};

asp.net-mvc – 如何运行Internet Explorer Selenium测试作为一个特定的域用户?

asp.net-mvc – 如何运行Internet Explorer Selenium测试作为一个特定的域用户?

我有一个ASP.NET MVC网站使用 Windows身份验证来控制访问.我想要有一个specflow selenium测试,通过尝试作为非授权用户访问该站点来检查配置是否正确.

当我们使用域帐户来控制访问时,没有用户名/密码登录屏幕.当前用户的凭据由浏览器自动传递到该站点.

所以对于我的Selenium测试,我需要能够以特定的用户身份运行Internet Explorer.

我发现了一些关于Windows模拟的文章,我可以在测试运行期间切换到我的测试用户(使用http://support.microsoft.com/kb/306158的代码).但是,如果我创建一个InternetExplorerDriver它启动Internet Explorer与我的凭据,而不是测试用户(虽然这个问题和答案表明它应该工作https://sqa.stackexchange.com/questions/2277/using-selenium-webdriver-with-windows-authentication).

我也可以显式地启动Internet Explorer进程作为我的测试用户,但是我看不到将InternetExplorerDriver绑定到已经运行的Internet Explorer进程的方式,所以这可能是一个死胡同.

我的代码,基本上是从上面的MSDN页面下面的.在调试器中,我可以看到WindowsIdentity.GetCurrent().Name在测试的所有步骤中都是“testUser”.

namespace MyProject.Specs
{
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using System;
using System.Runtime.InteropServices;
using System.Security.Principal;
using TechTalk.SpecFlow;

[Binding]
public class AuthorisationSteps
{
    public const int logoN32_logoN_INteraCTIVE = 2;
    public const int logoN32_PROVIDER_DEFAULT = 0;
    private static WindowsImpersonationContext impersonationContext;
    private static IWebDriver driver;

    [BeforeScenario]
    public static void impersonateUser()
    {
        if (!impersonateValidUser("testUser","testDomain","password"))
        {
            throw new Exception();
        }
        driver = new InternetExplorerDriver();
    }

    [AfterScenario]
    public static void cleanupUser()
    {
        undoImpersonation();
        driver.Quit();
    }

    [Given(@"I am an unauthorised user")]
    public void GivenIAmAnUnauthorisedUser()
    {
        var temp = WindowsIdentity.GetCurrent().Name;
    }

    [When(@"I go to the home page")]
    public void WhenIGoToTheHomePage()
    {
        var temp = WindowsIdentity.GetCurrent().Name;
        driver.Navigate().GoToUrl(BaseUrl);
    }

    [Then(@"I should see an error page")]
    public void ThenIShouldSeeAnErrorPage()
    {
        var temp = WindowsIdentity.GetCurrent().Name;
        Assert.That(driver.Title.Contains("Error"));
    }

    [DllImport("advapi32.dll")]
    public static extern int logonUserA(String lpszUserName,String lpszDomain,String lpszPassword,int dwlogonType,int dwlogonProvider,ref IntPtr phToken);

    [DllImport("advapi32.dll",CharSet = CharSet.Auto,SetLastError = true)]
    public static extern int Duplicatetoken(IntPtr hToken,int impersonationLevel,ref IntPtr hNewToken);

    [DllImport("advapi32.dll",SetLastError = true)]
    public static extern bool RevertToSelf();

    [DllImport("kernel32.dll",CharSet = CharSet.Auto)]
    public static extern bool CloseHandle(IntPtr handle);

    private static bool impersonateValidUser(String userName,String domain,String password)
    {
        WindowsIdentity tempWindowsIdentity;
        var token = IntPtr.Zero;
        var tokenDuplicate = IntPtr.Zero;

        if (RevertToSelf())
        {
            if (logonUserA(userName,domain,password,logoN32_logoN_INteraCTIVE,logoN32_PROVIDER_DEFAULT,ref token) != 0)
            {
                if (Duplicatetoken(token,2,ref tokenDuplicate) != 0)
                {
                    tempWindowsIdentity = new WindowsIdentity(tokenDuplicate);
                    impersonationContext = tempWindowsIdentity.Impersonate();
                    if (impersonationContext != null)
                    {
                        CloseHandle(token);
                        CloseHandle(tokenDuplicate);
                        return true;
                    }
                }
            }
        }
        if (token != IntPtr.Zero)
        {
            CloseHandle(token);
        }
        if (tokenDuplicate != IntPtr.Zero)
        {
            CloseHandle(tokenDuplicate);
        }
        return false;
    }

    private static void undoImpersonation()
    {
        impersonationContext.Undo();
    }
}

}

解决方法

这实际上是可行的.我遇到了你所拥有的确切问题.基本上,这里是您需要做的步骤.

>在后台使用其他用户凭据手动启动浏览器驱动

Process driverProcess;
string driverPath; // The path to Selenium's IE driver.
processstartinfo info = new processstartinfo(driverPath)
{
    UserName = "UserName",// The user name.
    Password = new securestring(),// The password for the user.
    UseShellExecute = false,LoadUserProfile = true,Arguments = "about:blank"
};
// Start the driver in background thread
Thread startThread = new Thread(
    () => {
        try
        {
            driverProcess = Process.Start(info);
            driverProcess.WaitForExit();
        }
        catch
        {
            // Close the process.
        }
    })
{
    IsBackground = true
};
startThread.Start();

>使用远程Web驱动程序来连接手动启动的浏览器驱动程序实例.

var remoteDriver = new RemoteWebDriver(Uri("http://localhost:5555"),DesiredCapabilities.InternetExplorer());

>记住在完成后关闭/退出/终止驱动程序进程和浏览器实例.

// Close the process when done.
if (driverProcess != null)
{
    // Free managed resources
    if (!driverProcess.HasExited)
    {
        driverProcess.CloseMainWindow();
        driverProcess.WaitForExit(5000);
        // Kill the process if the process still alive after the wait
        if (!driverProcess.HasExited)
        {
            driverProcess.Kill();
        }

        driverProcess.Close();
    }

    driverProcess.dispose();
    driverProcess = null;
}

Docker,Django和Selenium-Selenium无法连接

Docker,Django和Selenium-Selenium无法连接

我已经将Docker配置为使用docker-compose.yml运行Postgres和Django,并且工作正常。

我遇到的麻烦是Selenium无法连接到Django liveserver。

现在(至少对我而言),django必须访问selenium才能控制浏览器,而selenium必须访问django才能访问服务器。

我已经尝试从此处使用docker-
compose.yml的以下配置使用docker’大使’模式:https
:
//github.com/docker/compose/issues/666

postgis:  dockerfile: ./docker/postgis/Dockerfile  build: .  container_name: postgisdjango-ambassador:  container_name: django-ambassador  image: cpuguy83/docker-grand-ambassador  volumes:    - "/var/run/docker.sock:/var/run/docker.sock"  command: "-name django -name selenium"django:  dockerfile: ./docker/Dockerfile-dev  build: .  command: python /app/project/manage.py test my-app  container_name: django  volumes:    - .:/app  ports:    - "8000:8000"    - "8081:8081"  links:    - postgis    - "django-ambassador:selenium"  environment:    - SELENIUM_HOST=http://selenium:4444/wd/hubselenium:  container_name: selenium  image: selenium/standalone-firefox-debug  ports:    - "4444:4444"    - "5900:5900"  links:    - "django-ambassador:django"

当我检查http:// DOCKER-MACHINE-IP:4444 / wd / hub / static / resource /
hub.html时,
我可以看到Firefox启动了,但是由于Firefox无法连接到Django,所有测试都失败了

''Firefox can''t establish a connection to the server at localhost:8081''

我也在这里https://github.com/docker/compose/issues/1991尝试了此解决方案,
但是这不起作用,因为我无法让django同时连接到Postgis和Selenium

''django.db.utils.OperationalError: could not translate host name "postgis" to address: Name or service not known''

我尝试使用下面列出的网络功能

postgis:  dockerfile: ./docker/postgis/Dockerfile  build: .  container_name: postgis  net: appnetdjango:  dockerfile: ./docker/Dockerfile-dev  build: .  command: python /app/project/manage.py test foo  container_name: django  volumes:    - .:/app  ports:    - "8000:8000"    - "8081:8081"  net: appnet  environment:    - SELENIUM_HOST=http://selenium:4444/wd/hubselenium:  container_name: selenium  image: selenium/standalone-firefox-debug  ports:    - "4444:4444"    - "5900:5900"  net: appnet

但结果是一样的

''Firefox can''t establish a connection to the server at localhost:8081''

那么我怎样才能使selenium连接到Django?

我已经玩了好几天了-非常感谢您的帮助。

更多信息

另一个怪异的事情是,如果我运行./manage.py test foo,那么当测试服务器运行时 使用docker
(使用我的virtualenv等旧配置)时,我可以通过http://
localhost:8081上的任何浏览器访问服务器,并且获取提供的网页,但是如果我在docker下运行等效命令,则无法访问测试服务器。这很奇怪,因为我正在映射端口8081:8081-这与之相关吗?

注意:我正在使用OSX和Docker v1.9.1

答案1

小编典典

我最终提出了一个更好的解决方案,该解决方案不需要我对IP地址进行硬编码。以下是我使用docker在django中运行测试的配置。

Docker组成文件

# docker-compose base file for everythingversion: ''2''services:  postgis:    build:      context: .      dockerfile: ./docker/postgis/Dockerfile    container_name: postgis    volumes:      # If you are using boot2docker, postgres data has to live in the VM for now until #581 fixed      # for more info see here: https://github.com/boot2docker/boot2docker/issues/581      - /data/dev/docker_cookiecutter/postgres:/var/lib/postgresql/data  django:    build:      context: .      dockerfile: ./docker/django/Dockerfile    container_name: django    volumes:      - .:/app    depends_on:      - selenium      - postgis    environment:      - SITE_DOMAIN=django      - DJANGO_SETTINGS_MODULE=settings.my_dev_settings    links:      - postgis      - mailcatcher  selenium:    container_name: selenium    image: selenium/standalone-firefox-debug:2.52.0    ports:      - "4444:4444"      - "5900:5900"

Dockerfile(对于Django)

ENTRYPOINT ["/docker/django/entrypoint.sh"]

在入口点文件中

#!/bin/bashset -e# Now we need to get the ip address of this container so we can supply it as an environmental# variable for django so that selenium knows what url the test server is on# Use below or alternatively you could have used# something like "$@ --liveserver=$THIS_DOCKER_CONTAINER_TEST_SERVER"if [[ "''$*''" == *"manage.py test"* ]]  # only add if ''manage.py test'' in the argsthen  # get the container id  THIS_CONTAINER_ID_LONG=`cat /proc/self/cgroup | grep ''docker'' | sed ''s/^.*\///'' | tail -n1`  # take the first 12 characters - that is the format used in /etc/hosts  THIS_CONTAINER_ID_SHORT=${THIS_CONTAINER_ID_LONG:0:12}  # search /etc/hosts for the line with the ip address which will look like this:  #     172.18.0.4    8886629d38e6  THIS_DOCKER_CONTAINER_IP_LINE=`cat /etc/hosts | grep $THIS_CONTAINER_ID_SHORT`  # take the ip address from this  THIS_DOCKER_CONTAINER_IP=`(echo $THIS_DOCKER_CONTAINER_IP_LINE | grep -o ''[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'')`  # add the port you want on the end  # Issues here include: django changing port if in use (I think)  # and parallel tests needing multiple ports etc.  THIS_DOCKER_CONTAINER_TEST_SERVER="$THIS_DOCKER_CONTAINER_IP:8081"  echo "this docker container test server = $THIS_DOCKER_CONTAINER_TEST_SERVER"  export DJANGO_LIVE_TEST_SERVER_ADDRESS=$THIS_DOCKER_CONTAINER_TEST_SERVERfieval "$@"

在您的Django设置文件中

SITE_DOMAIN = ''django''

然后运行测试

docker-compose run django ./manage.py test

关于Internet Explorer 8 64位和Selenium无法正常工作的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于angularjs – Angular和Internet Explorer 11 – 输入无法正常工作、angularjs – Internet Explorer Selenium量角器e2e测试、asp.net-mvc – 如何运行Internet Explorer Selenium测试作为一个特定的域用户?、Docker,Django和Selenium-Selenium无法连接等相关知识的信息别忘了在本站进行查找喔。

本文标签: