Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.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
Python Selenium远程Web驱动程序:如何确定正在使用哪个IEDriverServer.exe(32位或64位)?_Python_Internet Explorer_Selenium_Selenium Webdriver - Fatal编程技术网

Python Selenium远程Web驱动程序:如何确定正在使用哪个IEDriverServer.exe(32位或64位)?

Python Selenium远程Web驱动程序:如何确定正在使用哪个IEDriverServer.exe(32位或64位)?,python,internet-explorer,selenium,selenium-webdriver,Python,Internet Explorer,Selenium,Selenium Webdriver,我通过一端的Python绑定和另一端的Selenium独立服务器使用Selenium。以下是我正在使用的服务器命令行: java -jar selenium-server-standalone-2.46.0.jar -Dwebdriver.ie.driver=IEDriverServer.exe IEDriverServer.exe有两种版本:32位和64位。有一个众所周知的错误,使用64位版本会导致测试执行速度非常慢。例如,向编辑框发送文本时,发送的每个字符需要4或5秒。解决方案是使用32位

我通过一端的Python绑定和另一端的Selenium独立服务器使用Selenium。以下是我正在使用的服务器命令行:

java -jar selenium-server-standalone-2.46.0.jar -Dwebdriver.ie.driver=IEDriverServer.exe
IEDriverServer.exe有两种版本:32位和64位。有一个众所周知的错误,使用64位版本会导致测试执行速度非常慢。例如,向编辑框发送文本时,发送的每个字符需要4或5秒。解决方案是使用32位驱动程序,即使在64位Windows上也是如此

当我使用32位版本运行时,我在创建IE浏览器实例时在服务器输出中看到:

Started InternetExplorerDriver server (32-bit)
然而,我似乎找不到一种方法来确定哪个版本正在客户端运行。它不会像IE版本那样在功能中返回

如何确定哪个驱动程序正在从客户端运行


谢谢。

我不确定,我们可以选择使用硒进行检查。可以做的是使用Browser对象,我们可以选择标题并将其映射到机器上运行的进程。 我已经编写了C#代码来打印浏览器路径(EXE),通过它我们可以确定浏览器是32位还是64位

public static void PrintBrowserDetails()
    {
        string procName = "iexplore";

        foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcessesByName(procName))
        {
            if (!string.IsNullOrEmpty(proc.MainWindowTitle))
            {
                if (proc.MainWindowTitle.Contains(Util.Browser.Title))
                {
                    System.Diagnostics.ProcessModuleCollection prm = proc.Modules;
                    foreach (System.Diagnostics.ProcessModule pm in prm)
                    {
                        if (pm.ModuleName.Contains("IEXPLORE.EXE"))
                        {
                            System.Diagnostics.FileVersionInfo fi = pm.FileVersionInfo;
                            Console.WriteLine(fi.FileName); // Output: C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE
                            Console.WriteLine(fi.FileVersion); // Output: 8.0.7601.17514
                            Console.WriteLine(fi.FileDescription); // Internet Explorer.
                        }
                    }
                }
            }
        }
    }
    // Util.Browser -> Selenium Browser object
希望这能对你有所帮助